Dremendo Tag Line

Print remainder of a division in C

printf() - Question 11

In this question, we will see how to print remainder of a division in C programming using the printf() function. To know more about printf() function click on the printf() function lesson.

Q11) Write a program in C to find the remainder by dividing int a=5 by int b=2.

Program

#include <stdio.h>
#include <conio.h>

int main()
{
    int a=5,b=2;
    printf("Remainder = %d",a%b);
    return 0;
}

Output

Remainder = 1
video-poster