-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Player
authored and
Player
committed
Sep 12, 2016
1 parent
c2813c0
commit a09c1b3
Showing
77 changed files
with
1,086 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
int i, j, k; | ||
printf("\n"); | ||
for(i=1; i<5; i++){ | ||
for(j=1; j<5; j++){ | ||
for(k=1; k<5; k++){ | ||
if(i != j && i !=j && j != k) | ||
printf("%d %d %d\n",i,j,k); | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/************************************************************************* | ||
> File Name: 1-10.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sat Sep 10 12:07:46 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int i, j; | ||
printf("\1\1\n"); | ||
for(i=1; i<11; i++){ | ||
for(j=1; j<=i; j++) | ||
printf("%c%c",219,219); | ||
printf("\n"); | ||
} | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/************************************************************************* | ||
> File Name: 1-11.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sat Sep 10 12:11:07 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int f1=1, f2=1, i; | ||
for(i=1;i<=20;i++) | ||
{ | ||
printf("%12d%12d",f1,f2); | ||
if(i%2==0) | ||
printf("\n"); | ||
f1=f1+f2; | ||
f2=f1+f2; | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/************************************************************************* | ||
> File Name: 1-12.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sat Sep 10 14:03:40 2016 | ||
************************************************************************/ | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
int i,j; | ||
int count=0; | ||
|
||
for (i=101; i<=200; i++) | ||
{ | ||
for (j=2; j<i; j++) | ||
{ | ||
/* 如果j能被i整出在跳出循环 */ | ||
if (i%j==0) | ||
break; | ||
} | ||
/* 判断循环是否提前跳出,如果j<i说明在2~j之间,i有可整出的数 */ | ||
if (j>=i) | ||
{ | ||
count++; | ||
printf("%d ",i); | ||
/* 换行,用count计数,每五个数换行 */ | ||
if (count % 5 == 0) | ||
printf("\n"); | ||
} | ||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/************************************************************************* | ||
> File Name: 1-13.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 10:02:50 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int i, x, y, z; | ||
for(i = 100; i < 1000; i++) | ||
{ | ||
x = i % 10; | ||
y = i / 10 % 10; | ||
z = i / 100 % 10; | ||
|
||
if(i == (x * x * x + y * y * y + z * z * z)) | ||
printf("%d\n", i); | ||
|
||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/************************************************************************* | ||
> File Name: 1-14.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 10:10:16 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int n, i; | ||
printf("Please input a integer:\n"); | ||
scanf("%d",&n); | ||
printf("%d=",n); | ||
for(i=2; i <= n; i++) | ||
{ | ||
while(n%i==0) | ||
{ | ||
printf("%d",i); | ||
n/=i; | ||
if(n!=1) | ||
printf("*"); | ||
} | ||
} | ||
|
||
printf("\n"); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/************************************************************************* | ||
> File Name: 1-15.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 10:39:23 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int score; | ||
char grade; | ||
printf("Please input a integer: "); | ||
scanf("%d",&score); | ||
grade=(score>90)?'A':((score>=60)?'B':'C'); | ||
printf("%c\n",grade); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/************************************************************************* | ||
> File Name: 1-16.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 10:43:32 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int a, b,t,r; | ||
printf("Please input two integers: "); | ||
scanf("%d %d",&a,&b); | ||
if(a<b) | ||
{ | ||
t=b; | ||
b=a; | ||
a=t; | ||
} | ||
|
||
r=a%b; | ||
|
||
int n= a*b; | ||
while (r!=0) | ||
{ | ||
a=b; | ||
b=r; | ||
r=a%b; | ||
} | ||
printf("zhe liang ge shu de zui da gong yue shu shi %d, zuixiao gongbeishu shi%d",b,n/b); | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/************************************************************************* | ||
> File Name: 1-17.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 11:24:55 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
char c; | ||
int letters=0,space=0,digits=0,others=0; | ||
printf("Please input some charactors: \n"); | ||
while((c=getchar())!='\n') | ||
{ | ||
if((c>='a'&&c<='z')||(c>='A'&&c<='Z')) | ||
letters++; | ||
else if(c>='0'&&c<='9') | ||
digits++; | ||
else if(c==' ') | ||
space++; | ||
else | ||
others++; | ||
} | ||
printf("charactors=%d,digits=%d,space=%d,others=%d",letters,digits,space,others); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/************************************************************************* | ||
> File Name: 1-18.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 11:36:42 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
int s=0,a,n,t; | ||
printf("Pleas input 'a' and 'n': \n"); | ||
scanf("a=%d, n=%d",&a,&n); | ||
t=a; | ||
while(n>0) | ||
{ | ||
s+=t; | ||
a=a*10; | ||
t+=a; | ||
n--; | ||
} | ||
printf("a+aa+...=%d\n",s); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/************************************************************************* | ||
> File Name: 1-19.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 11:58:59 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
#define N 1000 | ||
int main() | ||
{ | ||
int i, j, k, n, sum; | ||
int a[256]; | ||
for(i = 2; i <= N; i++) | ||
{ | ||
sum = a[0] = 1; | ||
k = 0; | ||
for(j = 2; j <= (i / 2); j++) | ||
{ | ||
if(i % j == 0) | ||
{ | ||
sum += j; | ||
a[++k] = j; | ||
} | ||
} | ||
if(i == sum) | ||
{ | ||
printf("%d=%d", i, a[0]); | ||
for(n = 1; n <= k; n++) | ||
printf("+%d", a[n]); | ||
printf("\n"); | ||
} | ||
|
||
} | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
long int i; | ||
int bonus1, bonus2, bonus4, bonus6, bonus10, bonus; | ||
scanf("%ld",&i); | ||
bonus1 = 100000 * 0.1; | ||
bonus2 = bonus1 + 100000 * 0.75; | ||
bonus4 = bonus2 + 200000 * 0.5; | ||
bonus6 = bonus4 + 200000 * 0.3; | ||
bonus10 = bonus6 + 400000 * 0.15; | ||
|
||
if(i<100000) | ||
bonus=i*0.1; | ||
else if(i<=200000) | ||
bonus=bonus1+(i-100000)*0.075; | ||
else if(i<=400000) | ||
bonus=bonus2+(i-200000)*0.05; | ||
else if(i<=600000) | ||
bonus=bonus4+(i-400000)*0.03; | ||
else if(i<1000000) | ||
bonus=bonus6+(i-600000)*0.015; | ||
else | ||
bonus=bonus10+(i-1000000)*0.01; | ||
printf("bonus=%d",bonus); | ||
printf("\n"); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/************************************************************************* | ||
> File Name: 1-20.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 12:17:08 2016 | ||
************************************************************************/ | ||
|
||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
float h,s; | ||
s=h=100; | ||
h=h/2; | ||
for(int i=2;i<=10;i++) | ||
{ | ||
s=s+2*h; | ||
h=h/2; | ||
} | ||
|
||
printf("the distance of 10th hit the ground is %f m,and the the high is %f m.\n",s,h); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/************************************************************************* | ||
> File Name: 1-21.c | ||
> Author: Tony | ||
> Mail: shouqitao@163.com | ||
> Created Time: Sun Sep 11 12:55:04 2016 | ||
************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main() | ||
{ | ||
int day, x1=0, x2; | ||
day = 9; | ||
x2=1; | ||
while(day>0) | ||
{ | ||
x1=(x2+1)*2; | ||
x2=x1; | ||
day--; | ||
} | ||
|
||
printf("Sum is %d\n",x1); | ||
return 0; | ||
} |
Binary file not shown.
Oops, something went wrong.