// Write a C++ program that takes two values of x(dividend) and
// y(divisor) from user and prints quotient and remainder of x/y
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,y,q,r;
cout<<"Enter dividend number x : ";
cin>>x;
cout<<"Enter divisor number y : ";
cin>>y;
cout<<"\n\n------------------------------------\n";
cout<<" Quotient and Remainder of x/y \n";
cout<<"------------------------------------\n";
q = x / y ;
r = x % y;
cout<<"Quotient = "<<q<<endl<<"Remainder = "<<r;
getch();
}
// y(divisor) from user and prints quotient and remainder of x/y
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,y,q,r;
cout<<"Enter dividend number x : ";
cin>>x;
cout<<"Enter divisor number y : ";
cin>>y;
cout<<"\n\n------------------------------------\n";
cout<<" Quotient and Remainder of x/y \n";
cout<<"------------------------------------\n";
q = x / y ;
r = x % y;
cout<<"Quotient = "<<q<<endl<<"Remainder = "<<r;
getch();
}
No comments:
Post a Comment