Friday, July 24, 2020

Write a Program find addition, subtraction, multiplication and division in C.

addition, subtraction, multiplication and division


#include <stdio.h>
int main()
{
   int fst, sec, add, sub, mul;
   float div;

   printf("Enter two integers\n");
   scanf("%d%d", &fst, &sec);
 
   add = fst + sec;
   sub = fst - sec;
   mul = fst * sec;
   div = fst / (float)sec; 

   printf("Addition = %d\n", add);
   printf("Subtraction = %d\n", sub);
   printf("Multiplication = %d\n", mul);
   printf("Division = %.2f\n", div);
 
   return 0;
}


OUTPUT

Enter two integers
5
5
Addition = 10
  Subtraction = 0
        Multiplication = 25
 Division = 1.00

No comments:

Post a Comment

Please do not any spam link in Comment Box