Initial commit: C language learning code

This commit is contained in:
2025-07-20 16:30:56 +08:00
commit 06e24173a6
139 changed files with 9303 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <stdbool.h>
// !函数原型声明
int num_sum(int begin, int end);
int main()
{
printf("%d\n", num_sum(1, 10));
printf("%d\n", num_sum(20, 30));
printf("%d\n", num_sum(35, 45));
return 0;
}
// !函数定义
int num_sum(int begin, int end)
{
int sum = 0;
for (int i = begin; i <= end; i++)
{
sum += i;
}
return sum;
}