提交 a8113757 编写于 作者: 每日一练社区's avatar 每日一练社区

update exercises

上级 62f75b25
......@@ -3,7 +3,7 @@
int main()
{
int i;
for (i = 1; i < 20; i++)
for (i = 1; i <= 100; i++)
{
if (i % 2 == 0)
printf("%d ", i * i / 2);
......
......@@ -10,7 +10,7 @@
## aop
### before
```cpp
#include <stdio.h>
```
### after
```cpp
......@@ -19,21 +19,65 @@
## 答案
```cpp
int main()
{
int i;
for (i = 1; i <= 100; i++)
{
if (i % 2 == 0)
printf("%d ", i * i / 2);
else
printf("%d ", (i * i - 1) / 2);
}
printf("\n");
}
```
## 选项
### A
```cpp
int main()
{
int i;
for (i = 1; i < 100; i++)
{
if (i % 2 == 0)
printf("%d ", i * i / 2);
else
printf("%d ", (i * i - 1) / 2);
}
printf("\n");
}
```
### B
```cpp
int main()
{
int i;
for (i = 1; i <= 100; i++)
{
if (i / 2 == 0)
printf("%d ", i * i / 2);
else
printf("%d ", (i * i - 1) / 2);
}
printf("\n");
}
```
### C
```cpp
int main()
{
int i;
for (i = 1; i <= 100; i++)
{
if (i % 2 == 0)
printf("%d ", i * i % 2);
else
printf("%d ", (i * i - 1) / 2);
}
printf("\n");
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册