How to cause the value of another method
-
The programme expects whether the year is visocotic or not. I need to cause the bool of the IsLeapYear method, and if the meaning of true is to write a visocotic year, if the meaning of false is not a vitic year. I would be grateful for any advice.
class Program { public static void Main(string[] args) {
Console.WriteLine(IsLeapYear(2014)); Console.WriteLine(IsLeapYear(1999)); Console.WriteLine(IsLeapYear(8992)); Console.WriteLine(IsLeapYear(1)); Console.WriteLine(IsLeapYear(14)); Console.WriteLine(IsLeapYear(400)); Console.WriteLine(IsLeapYear(600)); Console.WriteLine(IsLeapYear(3200)); FinalTesting(bool FinalTesting()); // I don't know what arguments do i need to type } public static bool IsLeapYear(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } public static void FinalTesting(bool IsLeapYear) //also idk { if (IsLeapYear == true) { // I don't know what should i type here too Console.WriteLine("leap year"); } else Console.WriteLine("common year"); } }
-
Change your method.
Main
as follows:public static void Main(string[] args) { bool isLeap = IsLeapYear(2014); FinalTesting(isLeap); }