πŸ“Š C Programming
Q. What will this code output?
Code:
#include <stdio.h>
int main() {
    int a = 5 / 2;
    printf("%d", a);
    return 0;
}
  • (A) 2.5
  • (B) 2
  • (C) 3
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2

Explanation: Integer division in C truncates the decimal part. 5 / 2 = 2.

Explanation by: Mr. Dubey
Integer division in C truncates the decimal part. 5 / 2 = 2.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
65
Total Visits
πŸ“½οΈ
11 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
89%
Success Rate