Friday, February 25, 2011

PROGRAMMING EXERCISE 2

Questions :

Calculate 3 numbers with using the formula below:- 

calculate=(num1*num2)-num3+(num2/num1). Do a complete C++ Coding.

#include<iostream.h>
main()
{
//declare variable
float num1,num2,num3,calculate;
//input1
cout<<"Enter Num1";
cin>>num1;
//input2
cout<<"Enter Num2";
cin>>num2;
//input3
cout<<"Enter Num3";
cin>>num3;
//formula
calculate=(num1*num2)-num3+(num2/num1);
//output
cout<<"Answer is="<<calculate;
return 0;
}






No comments:

Post a Comment