/* Question for interview in C language.
Que: What will be the condition in if(?) so that it print both "Hello!" an "Hi!" */
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
if(!(printf("Hello!")))
printf("Hello!");
else
printf("\nHi!");
getch();
}
Explanation: The printf() returns the no.of character to be printed.Eg. inthe above example it will return 6 and (!6=0). If(0) then it will execute the else part of the program.
Que: What will be the condition in if(?) so that it print both "Hello!" an "Hi!" */
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
if(!(printf("Hello!")))
printf("Hello!");
else
printf("\nHi!");
getch();
}
Explanation: The printf() returns the no.of character to be printed.Eg. inthe above example it will return 6 and (!6=0). If(0) then it will execute the else part of the program.
No comments:
Post a Comment