What will be the output of the following C code?#include <stdio.h> int main() { float x = 21.0; x %= 3.0; printf("%f",x); return 0; }
Question
What will be the output of the following C code?#include <stdio.h> int main() { float x = 21.0; x %= 3.0; printf("%f",x); return 0; }
Solution
The code will not compile. The modulus operator (%) is not applicable to floating point numbers in C. It can only be used with integers.
Similar Questions
what will be the output of the c program?
What will be the output of the following code?
What will be the output of the following C++ code?
What will be the output of the following program?
What will be the output of the following C code?#include <stdio.h>int main() { int i; for (i = 0; i < 5; i++); printf("%d\n", i); return 0;}
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.