//Use of arithmetic operators in C program.
//Arithmetic Operators: Addition, Subtraction, Multiplication, and
Division.
#include<stdio.h>
void main()
{
int number1,
number2;
printf("Enter
number1:");
scanf("%d",&number1);
printf("Enter
number2:");
scanf("%d",&number2);
printf("Addition : %d \n", number1 + number2 );
printf("Subtraction : %d \n", number1 - number2 );
printf("Multiplication:
%d \n", number1 * number2 );
printf("Division
: %d \n", number1 / number2
);
}
// This program handles only integer values as number1 and number 2 are declared as int.
|
Output of the
Program:
Enter number1:20
Enter number2:10
Addition : 30
Subtraction : 10
Multiplication: 200
Division : 2
No comments:
Post a Comment