Sunday, February 16, 2020

How to Addition, Subtraction, Multiplication, Division and Modulus operation on two integers in C language

#include <stdio.h>
#include <stdlib.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();
}

output:

 enter two values: 56
64

 a + b = 120
 a - b = -8
 a * b = 3584
 a / b = 0
 a modulus b = 56

No comments:

Post a Comment

python class topic video