Asked inCognizant,GenC

write a coding for given year is leap or not

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...
Cognizant GenC Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter