CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #40

Integer vs Double Division

mediumCasting

📄 Code

Read carefully — what does this print?
1#include <iostream>
2using namespace std;
3int main() {
4 int a = 7, b = 2;
5 double r1 = a / b;
6 double r2 = (double)a / b;
7 cout << r1 << " " << r2 << endl;
8 return 0;
9}

🎯 Your Answer