How to calculate add , subtract , multiply, divide in C language
In this post , you learn how to make differnt types of program using C . and also you learn how to build program such as :- Addition , Subtraction , Multiply, Divison.HII friends my name is satyam sahu , and wel come to our new latest post ,if you not have basic knowledge of c , don't mind this program is very simple and easy to use , you also get source code of thease program.Calculate addition in C language with source code
#include<stdio.h>
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1+ num2;
printf("\n The sum of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1+ num2;
printf("\n The sum of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
Output
Enter the first number= 5
Enter the second number= 4
The sum of two int num1 & num2 = 9
Enter the first number= 5
Enter the second number= 4
The sum of two int num1 & num2 = 9
Program to calculate Subtraction In C language with source code
#include<stdio.h>
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1- num2;
printf("\n The subtract of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1- num2;
printf("\n The subtract of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
Output
Enter the first number= 15
Enter the second number= 4
The sum of two int num1 & num2 = 11
Enter the first number= 15
Enter the second number= 4
The sum of two int num1 & num2 = 11
Program to calculate Multiply In C language with source code
#include<stdio.h>
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1* num2;
printf("\n The multiply of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1* num2;
printf("\n The multiply of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
Output
Enter the first number= 8
Enter the second number= 6
The multiply of two int num1 & num2 = 48
Enter the first number= 8
Enter the second number= 6
The multiply of two int num1 & num2 = 48
Program to calculate Divison In C language with source code
#include<stdio.h>
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1/ num2;
printf("\n The divison of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
#include<conio.h>
main()
{
int num1,num2,result;
clrscr();
printf("Enter the first number=");
scanf("%d",&num1);
printf("\n Enter the second number="); /* for new line*/
scanf("%d",&num2);
result=num1/ num2;
printf("\n The divison of two int num1 & num2 =%d",result); /* for new line*/
getch();
}
Output
Enter the first number=16
Enter the second number= 4
The divison of two int num1 & num2 = 4
Enter the first number=16
Enter the second number= 4
The divison of two int num1 & num2 = 4
2 Comments
can u share me contact no of Satyam Sahu ji
ReplyDelete7607418817
DeleteHey, What do you think about this post