C Programming :: Declarations and Initializations - Discussion
15 / 54
#include<stdio.h>
void main()
{
int i = 107, x = 5;
printf ((x > 7)? "%d" : "%c:, i)
}
#include<stdio.h>
void main()
{
int i = 107, x = 5;
printf ((x > 7)? "%d" : "%c:, i)
}
Aan execution error
Ba syntex error
Cprinting of k
Dnone of these
Show Explanation
printf ((x > 7)? "%d" : "%c:, i) x value assigned is 5 hence 5 is not greater than 7 so second condition i.e (%c:i)
will be executed means ascii value of small k is 107 so the character k will be printed.
Asked In ::
syntax is wrong
printf() should end with ; and there is no closing quotes for character literals
correct format is
printf((x>7)?"%d":"%c",i); then result will be 'k'
Read Full Answer
Report Error
Please Login First Click Here
if it prints k then code need to be correct first as your answer.(termination and double quotes not present)
#include
void main()
{
int i = 107, x = 5;
printf ((x > 7)? "%d" : "%c:", i);
}
Read Full Answer
Report Error
Please Login First Click Here
printf ((x > 7)? "%d" : "%c:, i) x value assigned is 5 hence 5 is not greater than 7 so second condition i.e (%c:i)
will be executed means ascii value of small k is 107 so the character k will be printed.
Read Full Answer
Report Error
Please Login First Click Here
Here in line no. 5, (x>7) will result to false as 5 is not greater than 7. So, %c part will get executed, meaning that the value of i won't be displayed, rather the character whose ASCII value corresponds to 107 i.e, 'k' will get displayed, hence option C is correct.
Read Full Answer
Report Error
Please Login First Click Here
if it print k, then code should be like this as your answer.
#include
void main()
{
int i = 107, x = 5;
printf ((x > 7)? "%d" : "%c:", i);
}
Read Full Answer
Report Error
Please Login First Click Here