Write a C Program to read two numbers from key board and perform addition, subtraction, division and multiplication using assignment operators. - Pratik Ghelani

Pratik Ghelani

Breaking

Thursday, January 10, 2019

Write a C Program to read two numbers from key board and perform addition, subtraction, division and multiplication using assignment operators.

Program:-

#include <stdio.h>

void main()
{
   int a, b, add, sub, mul;
   float divi;

   printf("Enter two integers\n");
   scanf("%d%d", &a, &b);

   add = a + b;
   sub = a - b;
   mul = a * b;
   divi = a / (float)b;   

   printf("Addition = %d\n", add);
   printf("subtraction = %d\n", sub);
   printf("Multiplication = %d\n", mul);
   printf("Division = %.2f\n", divi);


}


Output:-





No comments:

Post a Comment