suppose x and y are two double type variable that you want add as integer and assign to an integer variable . construct a C++ statement for the doing so
Answers
Answered by
8
#include<iostream>
using namespace std;
int main()
{
double x,y;
int z;
cout << "Enter two numbers : " ;
cin >> x >> y;
z = int (x + y);
cout << "The addition of two numbers is : " << z << endl ;
return 0;
}
Output:
Enter two numbers : 10.5 12.3
The addition of two numbers is 22.
Hope it helps!
rithisha21:
thanks dear
Similar questions