A

Admin • 833.24K Points
Coach

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
  • Correct Answer - Option(A)
  • Views: 29
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

Integer division 5/2 is 2, assigned to float a.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.