What is the problem in this program?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the problem in this program??

#include <iostream> using namespace std; int main() { int num1, num2; cout<<"Enter the value of num1"<<endl; cin>>num1; cout<<"Enter the value of num2"<<endl; cin<<num2; cout<<"the sum is"<<num1+num2; return 0; }

27th Oct 2023, 1:45 PM
Haram Abbas
Haram Abbas - avatar
11 Answers
+ 10
cin>>num2 instead of cin<<num2
27th Oct 2023, 2:26 PM
Sakshi
Sakshi - avatar
+ 6
Haram Abbas It doesn't give error, I already checked it.
28th Oct 2023, 1:43 PM
Sakshi
Sakshi - avatar
+ 2
on line 9 :- write cin>>num2; not cin<<num2;
28th Oct 2023, 7:50 AM
Alhaaz
Alhaaz - avatar
+ 2
Haram Abbas make a new variable sum and put sum of num1 and num2 and than print it eg:- int sum= num1+num2; cout<<"Sum : "<<sum;
28th Oct 2023, 11:16 AM
Alhaaz
Alhaaz - avatar
+ 1
I write but still giving error
28th Oct 2023, 11:02 AM
Haram Abbas
Haram Abbas - avatar
+ 1
https://code.sololearn.com/crdyP451Jw4b/?ref=app Updated You write cin>>num2 Instead of cin<<num2
29th Oct 2023, 4:28 AM
๐ŸŒ๐ŸŒŽ๐ŸŒแด€ษชแด๐ŸŒŽ๐ŸŒ๐ŸŒแดตโฟแตƒแถœแต—โฑแต›แต‰
๐ŸŒ๐ŸŒŽ๐ŸŒแด€ษชแด๐ŸŒŽ๐ŸŒ๐ŸŒแดตโฟแตƒแถœแต—โฑแต›แต‰ - avatar
0
Ok Thanks
27th Oct 2023, 3:31 PM
Haram Abbas
Haram Abbas - avatar
0
#include <iostream> using namespace std; int main() int n=9; if(n%2==0); { cout<<"Even number"; } else { cout<<"odd number"; return 0; }
27th Oct 2023, 3:51 PM
Haram Abbas
Haram Abbas - avatar
0
What is problem
27th Oct 2023, 3:51 PM
Haram Abbas
Haram Abbas - avatar
0
Replace cin<<num2 with cin>>num2
29th Oct 2023, 2:59 AM
Amresh Kumar Chaurasiya
Amresh Kumar Chaurasiya - avatar
0
Ok I got it Thank you
29th Oct 2023, 10:09 AM
Haram Abbas
Haram Abbas - avatar