4
Answers

C# Problem

Syed Hossain

Syed Hossain

15y
5.8k
1

Hi i m Syed

a new member of your forum. i m also new in C# language.

i have given a problem to solve in c# but can't get a grip.

the question is as follows:

Write a function method IsLeap which has an integer (a year) parameter and returns a Boolean value.  If the year is a leap year, it returns true otherwise it returns false. Implement IsLeap assuming that a leap year is any year divisible by 4.

 

Write C# code to do the following:

-          Prompt the user to enter a year ( use safeReadInteger from Lab 3)

-          Then call IsLeap

-          Use its output to display appropriate messages for the user.

 

Your console session may look as follows:

 

Please enter a year: ­1984

1984 is a leap year

 

Another session may look as follows:

 

Please enter a year: ­2007

2007 is not a leap year

if any one can help with the coding of the problem,  i will be very greatful.

 

Syed

Answers (4)