刚学
输入一个5位数(各个位置上的数不含0)判断是否中奖 /中奖规则,末尾号码为1,3,9三等奖,末尾后两位为29,46,21为二等奖.c(末尾后三位为875,326,596为一等奖,输入一个5位的彩票号,输出中奖的/循环结构
输入一个整数,然后求余判断是否中奖
using System;
public class Test
{
public static void Main()
{
int n = Convert.ToInt32(Console.ReadLine());
if(n%1000==875 || n%1000==326 || n%1000==596)
Console.WriteLine("恭喜你获得一等奖!");
else if(n%100==21 || n%100 == 29 || n%100 == 46)
Console.WriteLine("恭喜你获得二等奖!");
else if(n%10 == 1 || n%10 == 3 || n%10 == 9)
Console.WriteLine("恭喜你获得三等奖!");
else
Console.WriteLine("很遗憾本次没有中奖!");
}
}
using System;
public class Test
{
public static void Main()
{
int n = Convert.ToInt32(Console.ReadLine());
if(n%1000==875 || n%1000==326 || n%1000==596)
Console.WriteLine("恭喜你获得一等奖!");
else if(n%100==21 || n%100 == 29 || n%100 == 46)
Console.WriteLine("恭喜你获得二等奖!");
else if(n%10 == 1 || n%10 == 3 || n%10 == 9)
Console.WriteLine("恭喜你获得三等奖!");
else
Console.WriteLine("很遗憾本次没有中奖!");
}
}