Write a c pgm for leap year

Answers were Sorted based on User's Feedback



Write a c pgm for leap year..

Answer / sarayu

void main()
{
int yr;
printf("Enter the year");
scanf("%d",yr);
if(yr%4==0)
printf("given year is leap year");
else
printf("It is not a leap year");
getch();
}

Is This Answer Correct ?    50 Yes 17 No

Write a c pgm for leap year..

Answer / vasile

int isLeap (int year)
{
if ((year % 4) || !(year % 100) && (year % 400))
return 0;

return 1;
}

Is This Answer Correct ?    26 Yes 8 No

Write a c pgm for leap year..

Answer / kumari rina

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("\n enter the year");
scanf("%d",&n);
if(n%100==0)
{
if(n%400==0)
{
printf("\n year is leap year");
}
else
{
printf("\n year is not leep year");
}
}
else
{
if(n%4)
{
printf("\n year is leap year");
}
else
{
printf("\nyear is not leap year");

}
}
getch();
}

Is This Answer Correct ?    12 Yes 1 No

Write a c pgm for leap year..

Answer / narayan sharma

#include<stdio.h>
#include<conio.h>
void main()
{
int y;
clrscr();
printf("\n\n\t Enter The Year\n\n\t");
scanf("%d",&y);
if (y%100==0)
{
if (y%400==0)
printf("\n\n\t Leep Year\n\n");
else
printf("\n\n\tNot Leep\n\n\t");
}
else
{
if (y%4==0)
printf("\n\n\t Leep Year\n\n\t");
else
printf("\n\n\t Not Leep");
}
getch();
}

Is This Answer Correct ?    8 Yes 2 No

Write a c pgm for leap year..

Answer / azad sable,chiplun.

void main()
{
int yr;
clrscr();
printf("enter the year");
scanf("%d",&yr);
if(yr%100==0)
{
if(yr%400==0)
printf("\nLeap year");
else
printf(\nNot aleap year");
}
else
{
if(yr%4==0)
printf(\nLeap yaer");
else
printf("\nNot a leap year");
}
getch();
}

Is This Answer Correct ?    7 Yes 3 No

Write a c pgm for leap year..

Answer / aniket

#include <stdio.h>
#include <conio.h>

void main()
{
int year;
clrscr();

printf("\n\t : TO CHECK LEAP YEAR :");
printf("\n Enter your year : ");
scanf("%d", &year);

if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
{
printf("\n\a L E A P Y E A R");
}
else
{
printf("\n\a N O T L E A P Y E A R");
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No

Write a c pgm for leap year..

Answer / rukmanee

#include<stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf("\n enter a year:");
scanf("%d",&year);
if(year%2==0&&year%100==0&&year%400==0)
{
printf("the given year is a leap year");
}
else
{
printf("the given year is not a leap year :");
}
getch();
}

Is This Answer Correct ?    4 Yes 7 No

Write a c pgm for leap year..

Answer / anika

#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int y;
cout<<"enter any number ";
cin>>y;
if(y%4==0;)
cout<<"the number entered is a leap year ";
else
cout<<"it is not a leap year ";
getch();
}

Is This Answer Correct ?    10 Yes 14 No

Write a c pgm for leap year..

Answer / venkata rao padala

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

Is This Answer Correct ?    2 Yes 6 No

Write a c pgm for leap year..

Answer / rina

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

Is This Answer Correct ?    3 Yes 11 No

Post New Answer

More C Interview Questions

What is the purpose of the code, and is there any problem with it? unsigned int f( unsigned n ) { return –n & 7; }

1 Answers   Google,


A B C D E F G F E D C B A A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A

2 Answers  


Do pointers take up memory?

0 Answers  


How do I swap bytes?

0 Answers  


how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk.

3 Answers   Google,






What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char Space = ' '; char LineOfText; float count; LineOfText = getchar(); while ((LineOfText = getchar()) != '/n'); { count = strlen(LineOfText) - 1; while (count >= 0) { putchar(LineOfText[count]); count--; } } getchar(); return 0; }

2 Answers  


What's a "sequence point"?

3 Answers  


In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?

4 Answers  


What is c preprocessor mean?

0 Answers  


write a program to read a number and print in words that is in sentence for example 21,219 then output is "twenty one thousand and two hundred nineteen" by using only control flow statements (only loops and switch case )?

1 Answers   TCS,


What is character set?

0 Answers  


What is dynamic dispatch in c++?

0 Answers  


Categories