main()

{

int y;

scanf("%d",&y); // input given is 2000

if( (y%4==0 && y%100 != 0) || y%100 == 0 )

printf("%d is a leap year");

else

printf("%d is not a leap year");

}

main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 &am..

2000 is a leap year

Explanation:

An ordinary program to check if leap year or not.

 Is This Answer Correct ? 3 Yes 0 No

More C Code Interview Questions

int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?

write a origram swaoing valu without 3rd variable

#include<stdio.h> main() { int a = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a; *q=***a; printf("%d..%d",*p,*q); }

Write a program to model an exploding firecracker in the xy plane using a particle system

#define assert(cond) if(!(cond)) \ (fprintf(stderr, "assertion failed: %s, file %s, line %d \n",#cond,\ __FILE__,__LINE__), abort()) void main() { int i = 10; if(i==0) assert(i < 100); else printf("This statement becomes else for if in assert macro"); }

main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }

prog. to produce 1 2 3 4 5 6 7 8 9 10

#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }

Design an implement of the inputs functions for event mode

#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

Categories
• C Code (421)
• C++ Code (127)
• VC++ Code (17)
• Java Code (84)
• Dot Net Code (114)
• Visual Basic Code (11)
• Programming Code AllOther (62)