What should <условие> be for the code below to print “HelloWorld”?
if (<условие>) printf("Hello"); else printf("World"); What should <условие> be for the code below to print “HelloWorld”?
if (<условие>) printf("Hello"); else printf("World"); For example, <условие> could be !printf("Hello") .
exit(printf("Hello World")) --- Well, that is, exit (printf ("hello world") * 0), 1 ideone.com/vHkyIX - VladDAnother option came to mind. He, of course, for aesthetes, but still. No one said that this should be an honest condition.
The condition must be as follows (symbol to symbol):
1) printf("Hello"); if (0 To make it invisible, we write this:
#include <stdio.h> #define cond 1) printf("Hello"); if (0 int main(void) { if (cond) printf("Hello"); else printf("World"); return 0; } For those who do not understand how it works, make a substitution and format the code. It will be like this:
#include <stdio.h> int main(void) { if (1) printf("Hello"); if (0) printf("Hello"); else printf("World"); return 0; } @ Bob1995 , I am not personally familiar with C, but if it is logical to think, then this will not work. Here is an example from life:
if (в магазине есть мандарины) { идем в гости } else { идем домой } What should be in the store, that would have fulfilled both points?
This will not work, you need another branch of the conditional operator, for example:
if (<условие>) printf("Hello"); if (<условие>) printf("World"); Source: https://ru.stackoverflow.com/questions/373030/
All Articles