This coding question was asked in 2nd slot of TCS NQT for 2019 Batch.
Write a program to find out the given year is leap year or not. If the given input is leap year then print 1 else print 0.
Input- 2048
Output- 1
Note:- All the test cases must be passed there are 4 test cases(include public and private test cases) in the whole program.
#include <stdio.h>
int main(void) {
int year = 0;
scanf("%d",&year);
if (((year % 4 == 0) && (year % 100!= 0))
|| (year % 400 == 0)){
printf("1");
} else {
printf("0");
}
return 0;
}
TCS NINJA Questions - Top Questions with solutions
HR Questions - Asked Most of the times
Programming Proficiency MCQs - Very Important
TCS Coding Questions - To Clear your Concept
Interview Experience - To boost your self -
Command Line Arguments Example
A Huge Collection of C Programs
Write a program to find out the given year is leap year or not. If the given input is leap year then print 1 else print 0.
Input- 2048
Output- 1
Note:- All the test cases must be passed there are 4 test cases(include public and private test cases) in the whole program.
#include <stdio.h>
int main(void) {
int year = 0;
scanf("%d",&year);
if (((year % 4 == 0) && (year % 100!= 0))
|| (year % 400 == 0)){
printf("1");
} else {
printf("0");
}
return 0;
}
Are you looking for more Coding Questions
HR Questions - Asked Most of the times
Programming Proficiency MCQs - Very Important
TCS Coding Questions - To Clear your Concept
Interview Experience - To boost your self -
Command Line Arguments Example
A Huge Collection of C Programs
0 Comments