Program to use quotient and remainder in C Language
#include <stdio.h>
int main()
{
int x, y, quo, rem;
printf("Enter two number : ");
scanf("%d%d", &x, &y);
if (y)
{
quo = x / y;
rem = x % y;
printf("Quotient = %d,remainder=%d\n", quo, rem);
}
else
{
printf("Divide by zero error\n");
}
return 0;
}
output
Enter two number : 44
6
Quotient = 7,remainder = 2
Steps / Description
- Declare integer variable
x
,y
,quo
,rem
printf
inbuild function to display will givetwo
numbers- Pass to values to
scanf
If
condition- which will give value divided into
x
andy
printf
inbuild function to display the value ofquo
,rem