Tuesday, 3 April 2018

Calculation of Remainder in C


//Modulus Operator in C
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,q,rem;
 clrscr();
 printf("\nEnter Dividend\n");
 scanf("%d",&a);
 printf("Enter Divisor\n");
 scanf("%d",&b);
 rem=a%b;
 q=a/b;
 printf("\nWhen %d is divided by %d\n",a,b);
 printf("\nThe Quotient obtained is %d\n",q);
 printf("and the Remainder is %d",rem);
 getch();
}


No comments:

Post a Comment

Note: only a member of this blog may post a comment.