Modulus of two number in C language by R4R Team


program-

#include < stdio.h>
int main()
{
int a,b,c;
//Firt number input
printf("Enter first number\n");
scanf("%d",&a);
//second number input
printf("Enter second number\n");
scanf("%d",&b);
//Now find modulus
c=a%b;
//print it
printf("Modulus is %d",c);
}


output-

Enter first number
1
Enter second number
2
Modulus is 1

Enter first number
24
Enter second number
7
Modulus is 3

-In this program, we take a input of two number and store in variable 'a' or variable 'b' then modulus of first number by second number is store in variable 'c' and at last we print that number.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!