C++ Program to find the Remainder value without using modulus operator


#include<iostream> using namespace std; int main(){ int x,y; cout<<"Enter two number :"<<endl; cin>>x>>y; while(x>=y){ x=x-y; } cout<<"The Remainder value is :"<<x; return 0; }

Output:-

Enter two number :12 9
The Remainder value is :3