0
What is wrong in this code?//I wanted to make sum and difference of two numbers that the user inputs.
#include <iostream> using namespace std; int main() { int abc,xyz,dif,sum; cout<<"Please input 2 numbers on different lines:"<<end; cin>>abc; cin>>xyz; { sum=abc+=xyz; dif=abc-=xyz; cout<<"The sum of the inputed numbers is:"<<sum<<endl; cout<<"Diferenta dintre numere este :"<<dif<<endl; } return 0; }
1 Réponse
0
#include <iostream>
using namespace std;
int main() {
int abc,xyz,dif,sum;
cout<<"Please input 2 numbers on different lines:"<<endl;
cin>>abc;
cin>>xyz;
sum=abc+xyz;
dif=abc-xyz;
cout<<"The sum of the inputed numbers is:"<<sum<<endl;
cout<<"Diferenta dintre numere este :"<<dif<<endl;
return 0;
}