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; }

7th Dec 2017, 6:32 AM
David Gutiérrez López
David Gutiérrez López - avatar
1 Answer
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; }
7th Dec 2017, 6:50 AM
Light Dimf
Light Dimf - avatar