Life, the Universe, and Everything
Explanation:
The problem is self-explanatory. Run an infinite loop, read the numbers and keep on printing them until you get a 42.
Solution (C++):
#include<cstdio>
int main(){
int n;
while(1){
scanf("%d", &n);
if(n==42)
break;
printf("%d\n", n);
}
return 0;
}
Any suggestions are welcome.
No comments:
Post a Comment