recent posts

C program to perform addition, subtraction, multiplication and division



C program to perform addition, subtraction, multiplication and division

Hi, I'm Golam Rabbani. Today i will discuss about C programming. This is C tutorial. Greetings! How are you all? Hope everyone is well.

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 C program to perform addition, subtraction, multiplication and division Reviewed by Golam Rabbani on November 20, 2018 Rating: 5

No comments:

top navigation

Powered by Blogger.