using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 奇偶判断 { class Program { static void Main(string[] args) { Console.WriteLine("请输入数字"); int a = int.Parse(Console.ReadLine()); int b; b = a % 2; switch(b) { case 0: Console.WriteLine("您输入的数字是偶数"); break; //case 1: default: Console.WriteLine("您输入的数字是奇数"); break; } Console.ReadLine(); } } }
时间: 2024-11-10 03:33:32