To enter any two numbers and test all Arithmetic Operators

Program:

#include<stdio.h>

#include<conio.h>

void main()

{

    int a,b;

    clrscr();

    printf("Enter any two numbers : ");

    scanf("%d%d", &a,&b);

    printf("The Addition of  %d and %d is %d", a, b, a+b);

    printf("\nThe Subtraction  of  %d and %d is %d", a, b, a-b);

    printf("\nThe Multiplication of  %d and %d is %d", a, b, a*b);

    printf("\nThe Division of  %d and %d is %d", a, b, a/b);

    printf("\nThe Modulus of  %d and %d is %d", a, b, a%b);

}


Output:


Enter any two number : 20  10
The Addition of 20 and 10 is 30
The Subtraction of  20 and 10 is 10
The Multiplication of 20 and 10 is 200
The Division of 20 and 10 is 2


Next Topic        :  Relational Operators

Previous Topic :  Arithmetic Operators

No comments:

Post a Comment