Thursday, January 10, 2019

C Program Of Addition, Subtraction, Multiplication, Division, Of Two Number By User Input


Addition, Subtraction, Multiplication, Division, of two numbers:-

In this c program, we take two value as input from user, variables num1 and num2 and add, sub, mul, div, for results store, then we perform addition, subtraction, multiplication, division, and of these two numbers. In this program we take all variables double type for performing operation on both number, integer and real.

   /*
      Program : Arithmetic Operation
      Filename : arithmaticOperation.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
   */
  #include<stdio.h>
  int main()
   {
      double num1, num2, add, sub, mul, div;
      printf("Enter the first number :");
      scanf("%lf",&num1); 
      printf("Enter the second number :");      
      scanf("%lf",&num2);
          add=num1+num2;
          sub=num1-num2;
          mul=num1*num2;
          div=num1/num2; 
      printf("Addition is: %lf \n",add);
      printf("Subtraction is: %lf \n",sub);
      printf("Multiplication is: %lf \n",mul);
      printf("Division is: %lf \n",div);   
       return 0;
    }
 

Output : 


  Enter the first number : 100
  Enter the second number :5.5        
  Addition : 105.500000
  Subtraction :  94.500000
  Multiplication : 550.000000  
  Division : 18.181818   

0 comments:

Welcome to you in All Coding Help