Thursday, January 23, 2020

How to Perform Addition, Subtraction, Multiplication, Division and Modulus operation on two integers.


#include<stdio.h>
void main()
{ int a,b;
printf("\n enter two values: ");
scanf("%d %d",&a,&b);
printf("\n a + b = %d", a+b);
printf("\n a - b = %d", a-b);
printf("\n a * b = %d", a*b);
printf("\n a / b = %d", a/b);
printf("\n a modulus b = %d", a%b);
getch();
}

input:

 enter two values: 13  5

output:

 a + b = 18           
 a - b = 8
 a * b = 65
 a / b = 2
 a modulus b = 3

No comments:

Post a Comment

python class topic video