输入一个五位数 判断尾数是否中奖 C# VB

刚学
输入一个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("很遗憾本次没有中奖!");
}
}

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632