Pages

To Perform Addition, Subtraction, Multiplication and Division of Two No.

Thursday 10 January 2013
Write a Program to perform addition, subtraction, multiplication and division of Two Numbers.

#include <stdio.h>

int main()
{
   int first, second;
   int addition, subtract, multiply;
   float divide;

   printf("Enter two integers\n");
   scanf("%d%d", &first, &second);

   addition = first + second;
   subtract = first - second;
   multiply = first * second;
   divide   = first / (float)second; 

   printf("Sum = %d\n", addition);
   printf("Difference = %d\n", subtract);
   printf("Multiplication = %d\n", multiply);
   printf("Division = %.3f\n", divide);
   return 0;
}

No comments:

Post a Comment