I’m trying to write a piece of source code that is compatible with both C and Python compilers/interpreters, outputting "Hello World" in stdout
.
Here are two of my tries:
#if __STDC__
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
#else
print("Hello, World!")
exit()
#endif
""""
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
"""""
print("Hello World!")
However, both don’t work, leading to compile error.
You need to sign in to view this answers
Leave feedback about this