Compare commits

..

2 Commits

Author SHA1 Message Date
6c863dd1ce Merge branch 'main' of git.smallkun.cn:smallkun/class-notes 2025-02-28 08:41:57 +08:00
ff53142ba1 Auto commit 2025-02-28 08:41:06 +08:00
4 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#include <stdio.h>
int main(){
int num[30], i, j;
float result[6];
for(i=0;i<30;i++){
num[i] = 2+2*i;
}
for(i=0;i<30;i+=5){
result[i/5] = (num[i]+ num[i+1] + num[i+2] + num[i+3] + num[i+4])/5.0;
}
for(i=0;i<6;i++){
printf("%.2f ", result[i]);
}
printf("\n");
return 0;
}

View File

@ -0,0 +1,39 @@
#include <stdio.h>
int fib(int n){
if(n== 0 || n==1){
return 1;
}
return fib(n-1) + fib(n-2);
}
int main(){
int num[15], i;
for(i=0;i<15;i++){
num[i] = fib(i);
}
for(i=0;i<15;i++){
printf("%d ", num[i]);
}
printf("\n");
return 0;
}
/*
int main(){
int num[15] = {1, 1}, i;
for(i=2;i<15;i++){
num[i] = num[i-1] + num[i-2];
}
for(i=0;i<15;i++){
printf("%d ", num[i]);
}
printf("\n");
return 0;
}
*/

View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main(){
return 0;
}

View File

@ -435,18 +435,83 @@ int main(){
![image-20250220231426147](https://yp.smallkun.cn/markdown/image-20250220231426147.png!compress)
```c
#include <stdio.h>
int main(){
int num[30], i, j;
float result[6];
for(i=0;i<30;i++){
num[i] = 2+2*i;
}
for(i=0;i<30;i+=5){
result[i/5] = (num[i]+ num[i+1] + num[i+2] + num[i+3] + num[i+4])/5.0;
}
for(i=0;i<6;i++){
printf("%.2f ", result[i]);
}
printf("\n");
return 0;
}
```
### 数组-2
![image-20250220231434409](https://yp.smallkun.cn/markdown/image-20250220231434409.png!compress)
```c
#include <stdio.h>
int fib(int n){
if(n== 0 || n==1){
return 1;
}
return fib(n-1) + fib(n-2);
}
int main(){
int num[15], i;
for(i=0;i<15;i++){
num[i] = fib(i);
}
for(i=0;i<15;i++){
printf("%d ", num[i]);
}
printf("\n");
return 0;
}
/*
int main(){
int num[15] = {1, 1}, i;
for(i=2;i<15;i++){
num[i] = num[i-1] + num[i-2];
}
for(i=0;i<15;i++){
printf("%d ", num[i]);
}
printf("\n");
return 0;
}
*/
```
### 数组-3
![image-20250220231441384](https://yp.smallkun.cn/markdown/image-20250220231441384.png!compress)
```c
```
### 数组-4