Program help!

Hello,
How do I make a program does this:
dividing 115/45 and it only prints the whole integer which is 2
and takes the remaining 25 and put it in a cout statement?
 
std::cout << (115 / 45) << " " << (115 % 45) << std::endl;
Super simple version of this:

1
2
3
4
5
6
7
8
9
10
int main()
{
        // assigning a decimal to an integer automatically truncates the decimal value
         int num = 115/45;   
         int remainder = 115%45;
         cout << "The whole integer after division is: " << num << endl;
         cout << "The remainder after division is: " << remainder << endl;
         cin.ignore();
         return 0;
}
Last edited on
Topic archived. No new replies allowed.