View Code of Problem 28

#include<stdio.h>
#include<math.h>
int main()
{
int y=0;
scanf("%d",&y);
if (y%4==0&&y%100!=0||y%400==0)
printf("Leap Year",y);
  else 
    printf("Not Leap Year",y)
return 0;
}

/*
Main.cc: In function 'int main()':
Main.cc:7:11: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
 if (y%4==0&&y%100!=0||y%400==0)
     ~~~~~~^~~~~~~~~~
Main.cc:8:8: warning: too many arguments for format [-Wformat-extra-args]
 printf("Leap Year",y);
        ^~~~~~~~~~~
Main.cc:10:12: warning: too many arguments for format [-Wformat-extra-args]
     printf("Not Leap Year",y)
            ^~~~~~~~~~~~~~~
Main.cc:10:30: error: expected ';' before 'return'
     printf("Not Leap Year",y)
                              ^
                              ;
 return 0;
 ~~~~~~                        
*/

Double click to view unformatted code.


Back to problem 28