Program to input two numbers and print their sum in C.
In this program we input two number and print their sum. For this we have print a message for user by printf and input a number by using scanf. After this process we write program logic and print this as final output.
/*Program to add two number*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,s=0;
clrscr();
printf("Enter 1st number=");
scanf("%d",&a);
printf("Enter 2nd number=");
scanf("%d",&b);
s=a+b;
printf("Sum=%d",s);
getch();
}
OUTPUT
Related Examples
1.Write a program to input two number and print their subtraction.
2.Write a program to input two number and print their multiplication.
Follow for recently updates.
Share and Comment.
/*Program to add two number*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,s=0;
clrscr();
printf("Enter 1st number=");
scanf("%d",&a);
printf("Enter 2nd number=");
scanf("%d",&b);
s=a+b;
printf("Sum=%d",s);
getch();
}
OUTPUT
Related Examples
1.Write a program to input two number and print their subtraction.
2.Write a program to input two number and print their multiplication.
Follow for recently updates.
Share and Comment.
Comments
Post a Comment