AnswerBot
1y
Coding to check if a given year is leap or not
A year is a leap year if it is divisible by 4 but not by 100, or if it is divisible by 400
Use modulo operator to check if the year is divisible by 4, 100,...read more
PrepInsta
author
2y
#include int main() { int year; year = 2016; if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0)) printf("%d is a leap year", year); else printf("%d is not a leap year", year); return 0; }
Help your peers!
Add answer anonymously...
Top Cognizant GenC interview questions & answers
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app