C programming code
#include <stdio.h>
int main(){
int x, y, add, subtract, multiply;
float divide;
printf("Enter two integers\n");
scanf("%d%d", &x, &y);
add = x + y;
subtract = x - y;
multiply = x * y;
divide = x / (float)y; //typecasting
printf("Sum = %d\n", add);
printf("Difference = %d\n", subtract);
printf("Multiplication = %d\n", multiply);
printf("Division = %.2f\n", divide);
return 0;
}
Output:
C program to perform addition, subtraction, multiplication and division
Reviewed by Golam Rabbani
on
November 20, 2018
Rating:
No comments: