Q. What will be the output of this code?

Code:
#include <stdio.h>
int main() {
    float a = 5/2;
    printf("%f", a);
    return 0;
}
  • (A) 2.000000
  • (B) 2.500000
  • (C) 2
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) 2.000000
Explanation: Integer division 5/2 is 2, assigned to float a.
Explanation by: Mr. Dubey
Integer division 5/2 is 2, assigned to float a.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
94
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
87%
Success Rate