Skip to content

level_1_p01.c to level_1_p06.c#40

Open
Rainbowow wants to merge 18 commits intoluckymark:masterfrom
Rainbowow:master
Open

level_1_p01.c to level_1_p06.c#40
Rainbowow wants to merge 18 commits intoluckymark:masterfrom
Rainbowow:master

Conversation

@Rainbowow
Copy link
Copy Markdown

No description provided.

@@ -0,0 +1,21 @@
#include<stdio.h>
#include<windows.h>
main()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个空行

Sleep(10);
system("cls");
}
for(int i=50;i>=1;i--){
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

闻到了重复的味道,这两个循环较相似,设法消除之

int a,b,c,result;int i;
for(a=1;a<=9;a++)
for(b=0;b<=9;b++)
for(c=0;c<=9;c++){
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缩进有点不齐

int i,j;
for(i=2;i<=1000;i++){
if(prime(i)>0)
printf("%d\n",i);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缩进;
加大括号

printf("%d\n",i);
}
printf("\n");
printf("%d",(int)clock());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样算时间有点不准,因为程序启动等时间也没包含在了里面

int k;int i;
k=sqrt(m);
for (i=2;i<=k;i++)
if (m%i==0) break;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上大括号吧,我这种老手看起来都晕,真不知道循环包含哪些语句呢

int k;int i;
k=sqrt(m);
for (i=2;i<=k;i++)
if (m%i==0) break;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上;
我感觉你的缩进跟实际的层次结构不对

@Rainbowow
Copy link
Copy Markdown
Author

改了一些问题 增加了一些作业

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants