Please Give Coding For find the leap Year
,
4 Answers
3 years ago by Dhaya Beatzz
y=int(input("Enter A Year:"))
if y%4==0:
print("Leap Year")
else:
print("Not A Leap Year")
3 years ago by Dhaya Beatzz
CSharp, plus this is more accurate.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace HelloWorld
{
public class Program
{
public static void Main(string[] args)
{
int year = Convert.ToInt32(Console.ReadLine());
bool leap = true;
if(year % 4 == 0)
{
if(year % 100 == 0)
{
leap = false;
if(year % 400 == 0)
{
leap = true;
}
}
}else
{
leap = false;
}
if(leap == true)
{
Console.WriteLine("yes");
return;
}
Console.WriteLine("no");
}
}
}
3 years ago by John Reed
A simple solution in Python:
year = int(input())
if (year%4==0 and year%100!=0) or (year%400==0):
print("{0} is leap".format(year))
else:
print("{0} isn't leap".format(year))
3 years ago by luca6533
I'll be sending a C++ solution.
#include <iostream>
using namespace std;
int main(){
int year;
cin >> year;
if(year % 4 == 0){
cout << "The given year is a leap year." << endl;
}else{
cout << "The given year is NOT a leap year." << endl;
}
return 0;
}
- All the best, Quillsh Wammy.
3 years ago by Quillsh Wammy