Sample – Program to enter two integers and print the quotient and remainder.

by Nideesh C on February 8, 2011 · 0 comments

in C++




#include <iostream.h>
#include <conio.h>
int main()
{
clrscr();
int x,y,quotient,remainder;
cout << “Enter 2 integers greater than 0 : “;
cin>>x>>y;
quotient=x/y;
remainder=x-(quotient*y);
cout << “Quotient of ” << x << ” & ” << y << ” = ” << quotient << “\n”;
cout << “Remainder” << ” = ” << remainder << “\n”;
getch();
return 0;
}

This program takes in two integers x and y as a screen input from the user.
It then calculates their quotient and remainder and outputs them using the ‘cout’ command.

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to enter an integer and print out its successor.
  2. Sample – Program to enter an integer and output the cube of that integer.
  3. Sample – Program to enter a string and find its length.
  4. Sample – Program to draw circles.
  5. Sample program (multiplication using addition)

Leave a Comment

Previous post:

Next post: