Why this additional 7 digit number is displayed in output??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this additional 7 digit number is displayed in output???

//output Enter first number:45 Enter second number:34 45 is Maximum 4877184 34 is Minimum 4877184 https://code.sololearn.com/cEqm4kzc2F0e/#cpp #include<iostream> using namespace std; //pehla function declare kia int max(int ,int); //Dusra function declare kia int min(int ,int); //ye jo round bracket() me parameter han ye Formal parameter kehlatay han //main function start kia int main(){ int n1,n2; cout<<"Enter first number:"; cin>>n1; cout<<n1; cout<<"\nEnter second number:"; cin>>n2; cout<<n2; cout<<"\n"<<max(n1,n2)<<endl; cout<<min(n1,n2); } int max(int x,int y){ if(x>y){ cout<<x<<" is Maximum "; } else{ cout<<y<<" is Maximum "; } } int min(int x,int y){ if(x<y){ cout<<x<<" is Minimum "; } else{ cout<<y<<" is Minimum "; } }

15th Dec 2018, 1:46 PM
Aamir Mehmood
1 Answer
+ 1
Because you print return value of the max and min function, but no value are actually return. You can remove cout<< at line 18 and 19, then only call the min max function in those lines
15th Dec 2018, 1:58 PM
Taste
Taste - avatar