Dremendo Tag Line
t

Print remainder of a division in C++

cout - Question 11

In this question, we will see how to print remainder of a division in C++ programming using the cout statement. To know more about cout statement click on the cout statement lesson.

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

Program

#include <iostream>
#include <conio.h>

using namespace std;

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

Output

Remainder = 1
video-poster