View Code of Problem 28

#include<string.h>
main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		if(n%4==0&&n%100!=0)
			printf("Leap Year\n");
		if(n%400==0)
			printf("Leap Year\n");
		else
			printf("Not Leap Year\n");
	}
}
/*
Main.c:2:1: warning: return type defaults to 'int'
 main(){
 ^
Main.c: In function 'main':
Main.c:4:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  while(scanf("%d",&n)!=EOF){
  ^
Main.c:4:8: warning: incompatible implicit declaration of built-in function 'scanf'
  while(scanf("%d",&n)!=EOF){
        ^
Main.c:4:24: error: 'EOF' undeclared (first use in this function)
  while(scanf("%d",&n)!=EOF){
                        ^
Main.c:4:24: note: each undeclared identifier is reported only once for each function it appears in
Main.c:6:4: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    printf("Leap Year\n");
    ^
Main.c:6:4: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:8:4: warning: incompatible implicit declaration of built-in function 'printf'
    printf("Leap Year\n");
    ^
Main.c:10:4: warning: incompatible implicit declaration of built-in function 'printf'
    printf("Not Leap Year\n");
    ^
*/

Double click to view unformatted code.


Back to problem 28