View Code of Problem 119

#include<stdlib.h>
int ss(int x)
{
	if (x == 0)
		return 0;
	for (int i = 2; i < x; i++)
	{
		if (x%i == 0)
			return 0;
	}
	return 1;
}
int main()
{
	int n,i=1;
	while (scanf("%d", &n) != EOF)
	{
		if (ss(n))
		{
			printf("Case #%d: I'm richer than any one\n",i++);
		}
		else
			printf("Case #%d: What a fxcking day\n",i++);
	}
	return 0;
}
/*
Main.c: In function 'main':
Main.c:16:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  while (scanf("%d", &n) != EOF)
         ^~~~~
Main.c:16:9: warning: incompatible implicit declaration of built-in function 'scanf'
Main.c:16:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
Main.c:2:1:
+#include <stdio.h>
 int ss(int x)
Main.c:16:9:
  while (scanf("%d", &n) != EOF)
         ^~~~~
Main.c:16:28: error: 'EOF' undeclared (first use in this function)
  while (scanf("%d", &n) != EOF)
                            ^~~
Main.c:16:28: note: 'EOF' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
Main.c:16:28: note: each undeclared identifier is reported only once for each function it appears in
Main.c:20:4: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    printf("Case #%d: I'm richer than any one\n",i++);
    ^~~~~~
Main.c:20:4: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:20:4: note: include '<stdio.h>' or provide a declaration of 'printf'
Main.c:23:4: warning: incompatible implicit declaration of built-in function 'printf'
    printf("Case #%d: What a fxcking day\n",i++);
    ^~~~~~
Main.c:23:4: note: include '<stdio.h>' or provide a declaration of 'printf'
*/

Double click to view unformatted code.


Back to problem 119