Tuesday, February 15, 2011
EXERCISE C1 & C2
Add and minus two INTEGER numbers with using the formula below:
add= num1+num2
minus= num2-num1
ANSWER
# include <> #header
main ( )
{
// variable declaration
int num 1,num 2,add,minus ;
// input 1
Cout << " enter num 1 : " ;
Cin >> num 1 ;
// input 2
Cout << " enter num 2 : " ;
Cin >> num 2 ;
// formula
add = num 1 + num 2 ;
// output
Cout << add =" <<">
// formula
minus = num 2 - num 1 ;
// output
Cout << " minus = <<
minus ;
return 0 ;
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
thanks for comment..