In this program, user is asked to enter two integers. Then, the sum of those two integers is stored in a variable and displayed on the screen.
1.ADD TWO INTEGER NUMBER IN C.
#include<stdio.h>
#include<conio.h>
void main()
{
int firstnumber , secondnumber , sumofnumbers;
clrscr();
printf("Enter two number:-");
//two integer number entered by user is stored using scanf()
scanf("%d%d",&firstnumber,&secondnumber);
//sum of two number is stored in variable sumofnumbers
sumofnumbers=firstnumber+secondnumber;
//display sumofnumbers
printf("%d+%d=%d",firstnumber , secondnumber , sumofnumbers);
getch();
}
2.ADD TWO INTEGER NUMBER IN C++.
#include<iostream.h>
#include<conio.h>
void main()
{
int firstnumber , secondnumber , sumofnumbers;
clrscr();
cout<<"Enter two numbers in integer form:-";
//two integer number entered by user is stored using cin function
cin>>firstnumber>>secondnumber;
//sum of two number is stored in variable sumofnumbers
getch()
}
c program to add two numbers , program to find sum of two numbers , basic c programs , c programming addition , addition c program ,
simple c program to add two number
1.ADD TWO INTEGER NUMBER IN C.
#include<stdio.h>
#include<conio.h>
void main()
{
int firstnumber , secondnumber , sumofnumbers;
clrscr();
printf("Enter two number:-");
//two integer number entered by user is stored using scanf()
scanf("%d%d",&firstnumber,&secondnumber);
//sum of two number is stored in variable sumofnumbers
sumofnumbers=firstnumber+secondnumber;
//display sumofnumbers
printf("%d+%d=%d",firstnumber , secondnumber , sumofnumbers);
getch();
}
2.ADD TWO INTEGER NUMBER IN C++.
#include<iostream.h>
#include<conio.h>
void main()
{
int firstnumber , secondnumber , sumofnumbers;
clrscr();
cout<<"Enter two numbers in integer form:-";
//two integer number entered by user is stored using cin function
cin>>firstnumber>>secondnumber;
//sum of two number is stored in variable sumofnumbers
sumofnumbers=firstnumber + secondnumber;
//display sumofnumbers
cout<<"sumofnumbers = firstnumber + secondnumber"<<firstnumber<<secondnumber<<sumofnumbers;
}
c program to add two numbers , program to find sum of two numbers , basic c programs , c programming addition , addition c program ,
simple c program to add two number
No comments:
Post a Comment