Answer to Question #5716 in C++ for haruna

Question #5716
write a program that declares two integers and initializes them to 199 and 76. display the sum, difference, product, average, square, and remainder of the values
1
Expert's answer
2011-12-20T09:45:59-0500
# include <iostream>
# include <math.h>


using namespace std;


int main()
{
int num1 = 199, num2 = 76;
int sum = num1 + num2;
cout<<"sum = "<<sum<<endl;
int dif = num1 - num2;
cout<<"dif = "<<dif<<endl;
int prod = num1*num2;
cout<<"prod = "<<prod<<endl;
double aver = (num1 + num2)/2;
cout<<"aver = "<<aver<<endl;
int sqr1 = num1*num1;
cout<<"square1 = "<<sqr1<<endl;
int sqr2 = num2*num2;
cout<<"square2 = "<<sqr2<<endl;
int rem = num1%num2;
cout<<"reminder = "<<rem<<endl;


system ("Pause");
return 0;
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS