CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Integer Division Truncation

C code walkthrough · Question 1
easyPrinting

Code

Read carefully. What does this print?
1#include <stdio.h>
2 
3int main() {
4 int a = 7;
5 int b = 2;
6 int result = a / b;
7 printf("%d\n", result);
8 printf("%.2f\n", (float)a / b);
9 return 0;
10}

Your answer

Next