Write a C program for addition, subtraction, multiplication, division and modulus of two numbers
Program:-
#include <stdio.h>
#include <conio.h>
int main()
{
int a,b;
int sum, difference, product, modulo;
float quotient;
printf("Enter First Number: ");
scanf("%d", &a);
printf("Enter Second Number: ");
scanf("%d", &b);
sum = a + b;
difference =a - b;
product = a * b;
quotient = a /b;
modulo =a % b;
printf("\nSum = %d", sum);
printf("\nDifference = %d", difference);
printf("\nMultiplication = %d", product);
printf("\nDivision = %f", quotient);
printf("\nRemainder = %d", modulo);
getch();
return 0;
}
#include <conio.h>
int main()
{
int a,b;
int sum, difference, product, modulo;
float quotient;
printf("Enter First Number: ");
scanf("%d", &a);
printf("Enter Second Number: ");
scanf("%d", &b);
sum = a + b;
difference =a - b;
product = a * b;
quotient = a /b;
modulo =a % b;
printf("\nSum = %d", sum);
printf("\nDifference = %d", difference);
printf("\nMultiplication = %d", product);
printf("\nDivision = %f", quotient);
printf("\nRemainder = %d", modulo);
getch();
return 0;
}
Output :-
Input:
Enter the three sides of the Triangle
a=?
a=?
b=?
Output:-
...
...
...
...
...
...
...
0 comments:
Post a Comment