write c++ statement for the following
1. declare a variable to store 1009.87
2. declare a variable mail to store @.
3. declare a constant y to store 44.
4. accept a number from the user in the variable balance
5. display the output of variable balance
Answers
c++ statement
Explanation:
1. declare a variable n1 to store 1009.87
float n1=1009.87;
2. declare a variable mail to store @.
string mail="@";
3. declare a constant y to store 44.
const int y = 44;
4. accept a number from the user in the variable balance .
int balance;
cin>>balance;
5. display the output of variable balance.
cout<<balance;
C++ program
#include <iostream>
using namespace std;
int main()
{
int balance;
float n1=1009.87;
string mail="@";
const int y = 44;
cin>>balance;
cout<<balance;
return 0;
}
Output
45
45
Answer:
B. write c++ statement for the following.
1. declare a variable to store 1009.87
- float n1=1009.87;
2. declare a variable mail to store @.
- string mail="a";
3. declare a constant y to store 44.
- const int y=44
4. accept a number from the user in the variable balance
- int balance;
- cin<< balance;
5. display the output of variable balance
- cout<<balance;