Simple addition program In C++

in #program6 years ago

Hello friend today i am back with other simple program of addition ..
coding is the amazing thing and i love to code and i want to share my work with you i hope you will like this..

pr.PNG

#include< iostream>

using namespace std;
int main() // Main body of the program without with the program can,t be execute
{
int a , b , sum; // Initilizing values for sum

// a for the first integer value and b for the second integer value

cout<<"Enter values for addition "; // Cout statment is used to display the values of digits you writes on the screen

//Here i used this for the user to understand what to do.

cout<<endl; // endl statment in the count is used for line spacing

cin>>a>>b; //Cin is  use to take values form the user at run time.


sum = a + b; // taking the interger value for the addition 

cout<<"Sum =  "<<sum; // This cout statment is used for showing the answer saved in Sum

cout<<endl;

return 0; //I have used int with the main so now i have to return some intger values.

}

Result

ans.PNG
a = 10
b = 20
sum = 30

Follow me for the more programs for your daily life

Follow me @palwasha

Sort:  

BTW its a great post

This is good for the starters

wow cool.. nice program keep it up wish you the best of luck for the more programs and work have a nice day my freind

you are supporting this person its great to have peoples like you here

Nice! Thanks for this, I am (re)learning C++ right now, and soaking up all the tutorials I can get my hands on.

Loading...