Simple addition program In C++

avatar
(Edited)

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



6
0
0.000
0 comments