Addition is an easy and common method you can easily add 2+2=4
3+2=5, but now add 4332232+122332=???, to overcome these problem in programming, or to make addition by the help of a computer program, here I teach you basic of computer programming to add two number.
Basic Logic
If we need to add two variable (a+b) and display/save this value.
for this we can save the value of addition in another variable c, and then display c
c=a+b
to understand this program you should Know basic programming , and how to input a number and display it.
Program
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main ( ) //main starts
{
int a,b,c;
cout<<"Input 1st No.\n";
cin>>a;
cout<<"\nInput Second No.\n";
cin>>b;
c=a+b; // addition is performed
cout<<"\nThe Sum of Two No. is\t";
cout<<c;
cout<<"\n\n\n\t\t****Program Ends****";
getch(); // to hold the screen
} //main ends
3+2=5, but now add 4332232+122332=???, to overcome these problem in programming, or to make addition by the help of a computer program, here I teach you basic of computer programming to add two number.
Basic Logic
If we need to add two variable (a+b) and display/save this value.
for this we can save the value of addition in another variable c, and then display c
c=a+b
to understand this program you should Know basic programming , and how to input a number and display it.
Program
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main ( ) //main starts
{
int a,b,c;
cout<<"Input 1st No.\n";
cin>>a;
cout<<"\nInput Second No.\n";
cin>>b;
c=a+b; // addition is performed
cout<<"\nThe Sum of Two No. is\t";
cout<<c;
cout<<"\n\n\n\t\t****Program Ends****";
getch(); // to hold the screen
} //main ends
No comments:
Post a Comment