Modulus of 2 number in C++ by R4R Team

Example-
First number is n1=12
Second number is n2=5
Modulus(n1%n2) is 2

program-

#include
using namespace std;
int main()
{
int a, b, c;
cout << "Enter two numbersn";
cin >> a >> b;
c = a%b;
cout <<"Modulus of " << a <<" by "<< b<<" is: "<< c;
}


output-

Enter two numbers
5 3
Modulus of 5 by 3 is: 2




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!