我对 C# 很陌生,但遇到了一些问题。我已经尝试了一段时间,但我似乎无法做到这一点。我想我有这个想法,但我只是不知道如何让它发挥作用。我的书的章节中也没有任何例子。我需要“创建一个读取整数的应用程序,然后确定并显示它是奇数还是偶数。让用户输入一个整数并输出到控制台:您输入的数字是:输入值 + 偶数或奇数” I'我希望我能在这里得到一些帮助。也不是找人来做这项工作。如果你能解释它,请做!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Student_Challenge_Lab_2
{
class Program
{
// main method begins the execution of C# program
static void Main(string[] args)
{
int number1; // declares the integer to be added
// following code prompts user to input the two sets of integers
Console.Write("Please enter your integer: ");
number1 = Convert.ToInt32(Console.ReadLine());
int %(number1, );
// the program now tests to see if the integer is even or odd. If the remainder is 0 it is an even integer
if (% == 0)
Console.Write("Your integer is even.", number1);
else Console.Write("Your integer is odd.", number1);
}
} // end main
} // end Student challenge lab 2