What will be the output of the following C code if the value of 'p' is 10 and that of 'q' is 15?
#include<stdio.h>
int main()
{
int p,q;
printf("Enter two numbers\n");
scanf("%d",&p);
scanf("%d",&q);
#if(4<2)
printf("%d",p);
#elif(2>-1)
printf("%d",q);
#else
printf("bye");
#endif
}
#include<stdio.h>
int main()
{
int p,q;
printf("Enter two numbers\n");
scanf("%d",&p);
scanf("%d",&q);
#if(4<2)
printf("%d",p);
#elif(2>-1)
printf("%d",q);
#else
printf("bye");
#endif
}
A. 10
B. 15
C. bye
D. error
Answer: Option B
Related Questions on C Preprocessor
What is the purpose of the C preprocessor in C programming?
A. Compile C code
B. Optimize code
C. Preprocess code before compilation
D. Execute code
A. #define
B. #include
C. #ifdef
D. #pragma
What is the purpose of the #define directive in C preprocessing?
A. To include a header file
B. To define a macro
C. To declare a constant
D. To declare a variable
In C, which directive is used to conditionally include code based on preprocessor macros?
A. #ifdef
B. #ifndef
C. #if
D. #else
Join The Discussion