c# - 打印 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 处停止
解决方案
非常基本的方法
int tbl=53;
while (tbl < 96)
{
if (tbl % 7 == 0)
Console.WriteLine(tbl);
tbl++;
}
推荐阅读
- javascript - 使用 jquery 动态更改文本
- android - 什么占用了 Android Profiler 中的图形内存?
- r - 给定data.frame的特定行中的另一个日期,如何过滤过去的日期?
- java - 复选框验证,仅获取选中的复选框
- ios - 无法通过选择性注册构建 tensorflow iOS 二进制文件
- yii2 - Yii2 框架中的 CDbCriteria 在哪里?
- c++ - protobuf,dose release_* 方法导致函数中的内存泄漏?
- avro - 如何使用 Spring-Kafka 通过 Confluent Schema 注册表读取 AVRO 消息?
- sql-server - 如何刷新链接服务器中的表列表?
- python-3.x - 根据条件从列表中选择两个项目