Advertisement
cf1709

addSubMulDivLarger.c

Dec 20th, 2020 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main( void ){
  4.     float input1, input2;
  5.     float sum, diff, prod, quot;
  6.    
  7.     printf( "Enter the first number: " );
  8.     scanf( "%f", &input1 );
  9.     printf( "Enter the second number: ");
  10.     scanf( "%f", &input2 );
  11.    
  12.     sum = input1 + input2;
  13.     diff = input1 - input2;
  14.     prod = input1 * input2;
  15.     quot = input1 / input2;
  16.    
  17.     printf( "\n\nSum:\t\t%.4f", sum );
  18.     printf( "\nDifference:\t%.4f", diff );
  19.     printf( "\nProduct:\t%.4f", prod );
  20.     printf( "\nQuotient:\t%.4f", quot );
  21.    
  22.     if( input1 > input2 ){
  23.         printf( "\n\n%.4f is larger.", input1 );
  24.     }
  25.     else{
  26.         printf( "\n\n%.4f is larger.", input2 );
  27.     }
  28.    
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement