TCS NQT 2019 - Coding Question | 2nd Slot | Leap Year

This coding question was asked in 2nd slot of TCS NQT for 2019 Batch.


TCS NQT Coding Question


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 NQT Slot 2 Coding Question



Are you looking for more Coding Questions



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


Post a Comment

0 Comments