Header Ads Widget

Responsive Advertisement

C Calculation Program -2

Write a C program to perform arithmetic calculation between two numbers while assigning the values on runtime.

  #include<stdio.h>  //Start  the program
  #include<conio.h>

   int main()
  {
     printf("\n\t\tSIMPLE CALCULATION PROGRAM\n\n\n");  //Display the heading part.

     int a,b;    // Declaring the variables.
     printf("\n\tEnter your 1st number :");  //Displaying the message.
     scanf("\t%d",&a);  //Input value by the user.
     printf("\n\tEnter your 2nd number :");  //Displaying the message.
     scanf("\t%d",&b);  //Input value by the user.
    
     printf("\n\n\tSUM of two numbers are :\t%d",a+b);   //Addition
     
     printf("\n\n\tDIFFERENCE of two numbers are :\t%d",b-a);   //Subtraction
  
     printf("\n\n\tPRODUCT of two numbers are :\t%d",a*b); //Product
  
     printf("\n\n\tDIVISION of two numbers are :\t%d",b/a); //Division
     
     printf("\n\n\tMODULUS of two numbers are :\t%d",a%b); //Modulus
  
     getch();
}                    // End of the program.

 &: Sizeof operator - It is used to compute the size of  its operand.

OUTPUT : 
         


Write a C program to perform arithmetic calculation between two numbers.



Post a Comment

0 Comments