27: W.A.P. to decide whether year is leap year or not.

 

27: W.A.P. to decide whether year is leap year or not.

Program:

#include <stdio.h>

#include <conio.h>

 

void main()

{

   clrscr();

   int year;

   printf("Enter the 'Year' = ");

   scanf("%d", &year);

 

   if (year % 4 != 0)

   {

      printf("%d is not the 'Leap Year'.", year);

   }

   else

   {

      if (year % 100 == 0)

      {

         if (year % 400 == 0)

         {

            printf("%d is the 'Leap Year'.", year);

         }

         else

         {

            printf("%d is not the 'Leap Year'.", year);

         }

      }

      else

      {

         printf("%d is the 'Leap Year'.", year);

      }

   }

   getch();

}


Please follow me for more practicals....

 

 

Output:

Enter the 'Year' = 2023

2023 is not the 'Leap Year'.


Please follow me for more practicals....

 

Algorithm:

1.      START

2.      Declare year

3.      Enter the value of year.

4.      if (year % 4 != 0) then goto step 5 else goto step 6.

5.      Display Not a Leap Year.

6.      if (year % 100 == 0) then goto step 7 else goto step 10.

7.      if (year % 400 == 0) then goto step 8 else goto step 9.

8.      Display It is a Leap Year.

9.      Display Not a Leap Year.

10.  Display It is a Leap Year.

11.  STOP

 

Please follow me for more practicals....


Flowchart:





Please follow me for more practicals....

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.