Addition of two Numbers in C
The Addition of two numbers in c with the help of arithmetic operator and print the sum of two numbers. for example we enter two number is 6,6 and the sum is equal to 12.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum;
printf("enter two numbers\n");
scanf("%d%d",&a,&b);
sum=a+b;
printf("sum of two numbers=%d",sum);
getch();
}
similarly, we create subtraction,multiplication,division program.
Addition using without third variable
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter the two numbers\n");
scanf("%d%d",&a,&b);
a=a+b;
printf("sum of two numbers=%d",a);
getch();
}
No comments:
Post a Comment