World Languages, asked by usmanmahar985, 4 months ago

write down a code in c++ that takes two inputs from user in float type and perform addition and multiplication and display the result on output screen using explicit type casting anf also show result in 4 decimal places​

Answers

Answered by Pakiki
24

1) Simple C++ program to add two numbers

In this program we are asking user to input two integer numbers and then we are adding them and displaying the result on screen.

#include <iostream>

using namespace std;

int main(){

//Declaring two integer variables

int num1, num2;

/* cout displays the string provided in the

* double quotes as it is on the screen

*/

cout<<"Enter first integer number: ";

/* cin is used to capture the user input

* and assign it to the variable.

*/

cin>>num1;

cout<<"Enter second integer number: ";

cin>>num2;

cout<<"Sum of entered numbers is: "<<(num1+num2);

return 0;

}

Output:

Enter first integer number: 10

Enter second integer number: 20

Sum of entered numbers is: 30

Answered by cuteangel0001
1

\huge\mathcal{\fcolorbox{cyan}{black}{\pink{ᴀɴsᴡᴇʀ࿐}}}

1) Simple C++ program to add two numbers

In this program we are asking user to input two integer numbers and then we are adding them and displaying the result on screen.

#include <iostream>

using namespace std;

int main(){

//Declaring two integer variables

int num1, num2;

/* cout displays the string provided in the

* double quotes as it is on the screen

*/

cout<<"Enter first integer number: ";

/* cin is used to capture the user input

* and assign it to the variable.

*/

cin>>num1;

cout<<"Enter second integer number: ";

cin>>num2;

cout<<"Sum of entered numbers is: "<<(num1+num2);

return 0;

}

Output:

Enter first integer number: 10

Enter second integer number: 20

Sum of entered numbers is: 30

Similar questions