Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having problems with this one as it keeps giving me errors, it is 7.17 in C# ,(Visual C# 2012, How to Program), the Even or

Having problems with this one as it keeps giving me errors, it is 7.17 in C# ,(Visual C# 2012, How to Program), the Even or Odd program:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace Seven {

// Class definition // class EvenOrOdd { /* Method to find out if the number is an even number @param number is the integer to be checked return true if number is even, false otherwise. */

static bool isEven(int number) { // Divide the number by 2 and check if the remainder is 0. If so, return true; false otherwise. if (number % 2 == 0)

return true;

else

return false; }

//main() static void Main(string[] args) { // Header message Console.WriteLine("---------- Even or Odd ----------"); // Variable to store the number int number; // Variable to store the value returned by isEven() method bool check; // Loop to input values for (int i = 1; i <= 5; i++); }

// Prompt the user to input the value Console.Write("input the number: "); // Take the value as input number=Convert.ToInt32(Console.ReadLine()); check=isEven(number); // Chaeck if method returns true if(checked==true) // Display the success message Console.WriteLine("{0} is an even number", number);

else // Display the failure message Console.WriteLine("{0} is not an even number", number); } //end loop Console.Write("Good Bye..."); Console.ReadKey(); //end main() } // End Class }

Thank you for any help and why I am getting error # CS1519

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions