首页 > 解决方案 > 打印 53 到 96 之间 7 的倍数

问题描述

我想打印 53 到 96 之间的 7 的倍数

代码:

int tbl = 0;
while(!(tbl > 53) || !(tbl < 96))
{
   tbl = tbl + 7;
   while(tbl > 53 && tbl < 96)
   {
      Console.WriteLine(tbl);
      tbl = tbl + 7;
   }
}
Console.ReadLine();

输出:

输出

输出应该是: 56, 63, 70, 77, 84, 91 它应该在 91 处停止,但不是在 91 处停止

标签: c#

解决方案


非常基本的方法

int tbl=53;
while  (tbl < 96)
{
   if (tbl % 7 == 0)
      Console.WriteLine(tbl);

   tbl++;
}

推荐阅读