Saturday, April 29, 2023

Find a year is leap year or not .

 //find a year is leap  year or not 

#include "stdio.h"

int main ()

{

int yr;

printf ("Enter the year:\n");

scanf ("%i",&yr);

if (yr>=1000 && yr%4==0)

{

printf (" %d is a leap year \n",yr);

}

 

else if (yr>=1000 && yr%4!=0)

{

printf ("%i is not a leap year \n",yr);

}

else if (yr<1000)

{

printf ("Enter a vaid year that is greter than 1000\n");

}

return 0;

}

     

          output             output                    output 

Enter the year:

2023

2023 is not a leap year

                                                           or 

Enter the year:

2024

 2024 is a leap year

                                                     or 

Enter the year:

999

Enter a vaid year that is greter than 1000

No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...