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

Truncation vs Real Division in Casts

mediumCasting

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2int main() {
3 double d = 7.9;
4 int i = (int) d;
5 double avg = (double)(5 + 2) / 2;
6 printf("%d %.1f", i, avg);
7 return 0;
8}

🎯 Your Answer