ask Using two integers num1 and mun2

divide the first by the second

print out guotient and remainder both ints

output looks like this

First number entered

second number entered

Quotient

Remainder

Francis Waldron 0 Newbie Poster

ask Using two integers num1 and mun2

divide the first by the second

print out guotient and remainder both ints

output looks like this

First number entered

second number entered

Quotient

Remainder

```
/********************************************************
* Name: template
* Author: Francis Waldron
* Date due: 25/09/06
* Description: basic C++ programming
**********************************************************/
/***************************
* libraries
****************************/
#include <iostream> // needed for Cin and Cout
using namespace std;
/************************************
* defines
*************************************/
#define PI 3.14159
/*************************************
* function prototype
*************************************/
/************************************
* global variables
*************************************/
int main()
{
float num1 = 0;
float num2 = 0;
int quotient = 0;
int remainder = 0;
quotient = num1 / num2;
remainder = num1 % num2;
cout << " first number entered: ";
cin >>num1;
cout << " second number entered: ";
cin >>num2;
if(num2 == 0)
{
cout << num2<< " Cannot divide by Zero";
}
cout << "Quotient: /n";
cout << "Remainder: /n";
system("pause");
return 0;
}
```

rati 0 Junior Poster in Training

cout<<quotient;

TylerSBreton 13 Junior Poster in Training

if a and b are integers.....

quotient = a / b;

remainder = a % b;

may4life 2 Junior Poster in Training

Here's how its supposed to handle. Check it out and hope it helps

```
#include <iostream>
using namespace std;
int main()
{
int num1=0;
int num2=0;
int quotient=0;
int remainder=0;
cout << "first number entered: ";
cin >> num1;
cout << "second number entered: ";
cin >> num2;
if (num2==0)
{
cout << num2 << " Cannot divide by Zero\n";
} else
{
quotient = num1 / num2;
remainder = num1 % num2;
cout << "Quotient: " << quotient << endl;
cout << "Remainder: " << remainder << endl;
//system("pause"); // you really need this??
}
return 0;
}
```

Francis Waldron 0 Newbie Poster

thanks for all your help . Everything work great now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.