Friday, 6 July 2012

c program to find leap year or not (if,else)


In this c program u need to input an year to find leap year or not

For beginners
{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software). like Code::Blocks, dev c++  Download dev c++ its free and install it in your computer.open  dev c++ go to file-->new-->source file.}


#include<stdio.h>
#include<conio.h>
main()
{
      int y;
      printf("enter an year\n");
      scanf("%d",&y);
      if(y%4==0)
      {
                printf("%d is a leap year",y);
                }
                else
                {
                    printf("%d is a not a leap year",y);
                    }
                    getch();
                    }

For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}


IS IT HELPFIL? comment.

No comments:

Post a Comment