A
Q. Which of the following is the correct output for the program given below?
#include <stdio.h> int main ( ) { float floatvalue = 8.25; printf ("%d\n " , (int) floatvalue); return 0; }
In the given C program:
#include <stdio.h> int main ( ) { float floatvalue = 8.25; printf ("%d\n", (int) floatvalue); return 0; }
- floatvalue is initialized as 8.25 (a float type).
- (int) floatvalue typecasts 8.25 to an int, which removes the decimal part, resulting in 8.
- The %d format specifier is used in printf(), which expects an int. Since we are explicitly typecasting floatvalue to int, it prints 8.
Correct Output:
(D) 8 ✅
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. The parameter passing mechanism for an array is
Q. A preprocessor directive is always preceded by a symbol
Q. In a C program constant is defined
Q. What is the output of C Program with switch statement or block?
Q. What is the output of the C Program?
Q. If p is an integer pointer with a value 1000, then what will the value of p + 5 be?
Q. The information about an array used in program will be stored in
Q. Which of the following mode argument is used to truncate?
Discusssion
Login to discuss.