**New course!**Every coder should learn

**Generative AI!**

+ 3

# How to give combined result of division operation as there are two different operators for displaying quotient and remainder

is it possible by using float datatype for answer variable

7 Answers

+ 7

#include <iostream>
using namespace std;
int main ()
{
int numerator = 12;
int denominator = 5;
int div_res = numerator/denominator;
int div_rem = numerator%denominator;
cout << numerator << "/" << denominator << " is equals to " << div_res << " with remainder of " << div_rem;
return 0;
}

+ 3

yeah it worked.but Iam still confused about that.thank you @subham mittal

+ 2

nice but how to show complete answer in decimal value like 15/7=1.5

+ 2

you can typecast the denominator into float data type and take div_res as float

+ 2

can you explain it with code @SubhamMittal

+ 2

float div_res= numerator/(float) denominator;
try this.... this may help you... if your code is in c if it is in c++ then use
float (denominator)

+ 2

I can't understand the typecasting of denominator
hey are you there