Computer Science, asked by reomo, 1 year ago

Write a program in C/C++ to calculate and prints the product , quotient and the remainder of two integers.830 and 15.

Answers

Answered by jayshreerathod1
2

In this C++ program, user is asked to enter two numbers and program calculates the quotient and remainder of two numbers entered by user.

First we need to become familiar with some basic terminologies of division operation.

The number which is being divided is called dividend.The number by which we divide is called divisor.The result of division is called quotient.The number left over is called remainder.

In this C++ program, first we want to find the quotient of two numbers.  The quotient of two numbers is calculated by dividing the dividend by divisor. So, the formula for quotient is:

Quotient = Dividend / Divisor

The next part of our program is based on the question, How to find remainder in C++?

The remainder is calculated by using mod( % ) operator between two operands. So, the formula for remainder  is:

Remainder = Dividend % Divisor

Now, we have the all the necessary formulas and we can use them to build a C++ program to find quotient and remainder of two numbers entered by user.

 Recommended reading: How to add two numbers using classes in C++

C++ Code to Find Quotient and Remainder:#include<iostream> using namespace std; int main() { int quotient,remainder; int divisor,dividend; cout<<"ENTER DIVIDEND:"; cin>>dividend; cout<<"ENTER DIVISOR:"; cin>>divisor; quotient=dividend/divisor; remainder=dividend%divisor; cout<<"QUOTIENT="<<quotient<<endl; cout<<"REMAINDER="<<remainder; return 0; } Code Explanation:

First of all, we declared 4 variables named dividend,  divisor,  quotient remainder. All these variables are of integer data type. We cannot declare them as float  because modulus ( % ) operator can never be applied on floating-type variables.

After that, we simply asked the user to enter the values of dividend and divider. We applied division operation on provided values and found the value of quotient. Next, we applied mod( % ) operator on provided values and found remainder of division.

 Recommended reading: Convert Years of Age into Months, Days, Hours And Minutes in C++

At the end, we simply printed the values of quotient and remainder on the screen.

Dry Run:

Let’s dry run this code to see how it works:

Suppose 48 and 5 are hypothetical values of dividend and divisor respectively.

Quotient = Dividend / Divisor = 48 / 5 =9

Remainder = Dividend / Divisor = 48 % 5 = 3



reomo: Thnx but I want just program so plz if u do then write program
jayshreerathod1: #include<iostream>
using namespace std;
int main()
{
int quotient,remainder;
int divisor,dividend;
cout<<"ENTER DIVIDEND:";
cin>>dividend;
cout<<"ENTER DIVISOR:";
cin>>divisor;
quotient=dividend/divisor;
remainder=dividend%divisor;
cout<<"QUOTIENT="<<quotient<<endl;
cout<<"REMAINDER="<<remainder;
return 0;
}
reomo: Thnx dear
jayshreerathod1: welcome
Answered by ArianneHester
0

Answer:

THE PROGRAM IS AS FOLLOWS

#include <iostream>

using namespace std;

int main() {

    cout << 830*15 <<  " " << 830/15 << " " << 830%15;

    return 0;

}

the program does nothing but just prints the product, quotient and remainder

of 830 and 15.

Reference:

for further queries please visit the following

for arithmetic operators

https://brainly.in/question/16012066

for modulo operator

https://brainly.in/question/3824772

Similar questions