Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

level_1_p01.c to level_1_p06.c #40

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Rainbowow
Copy link

No description provided.

@@ -0,0 +1,21 @@
#include<stdio.h>
#include<windows.h>
main()
Copy link
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
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
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
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
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
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
Owner

Choose a reason for hiding this comment

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

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

@Rainbowow
Copy link
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