baybaye 2015-10-04 11:24 采纳率: 70%
浏览 1679
已结题

c语言 一个小程序 求大神

• Write a program that outputs 6 random number in the range of 1-45
• Hint: % operator
• Allow duplicate numbers
例子)
You can win the first prize at lotto !! 19 27 23 15 34 40 图片说明

  • 写回答

4条回答 默认 最新

  • tonigthdream 2015-10-04 12:41
    关注

    static void Main(string[] args)
    {
    Random objRandom = new Random();
    string nums = null;
    for (int i = 0; i < 6; i++)
    {
    nums += objRandom.Next(1, 45) + " ";
    }
    Console.WriteLine(nums);
    Console.ReadKey();
    }

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统