+ 1
please what s problem in this code
#include <iostream> using namespace std; int larger (int num1 ,int num2 ); int main() { int n1 ,n2 ; cout << " enter 2 numbers \n"; cin >> n1>>n2 ; cout <<"larger is "<<larger (n1,n2)<<"\n"; } int larger (int num1,int num2) { if(num1>num2) return num1; else return num 2; }
3 Antworten
+ 3
It should num2 not num 2. The whole code as follows:
#include <iostream>
using namespace std;
int larger (int num1 ,int num2 );
int main()
{
int n1 ,n2 ;
cout << " enter 2 numbers \n";
cin >> n1>>n2 ;
cout <<"larger is "<<larger (n1,n2)<<"\n";
}
int larger (int num1,int num2)
{
if(num1>num2)
return num1;
else
return num2;
}
+ 2
thanks it 's run
+ 2
Please learn that it is important to read the comments of the debuger 🙃