- 博客(8)
- 收藏
- 关注
原创 2020-12-15素数判断
#include <stdio.h>int is_prime(int n){int b = 0;for (b = 2; b < n; b++){if (n%b == 0)return 0;}return 1;}int main(){int i = 0;for (i = 100; i <= 200; i++)if (is_prime(i) == 1)printf("%d", i);}
2020-12-15 14:50:10 85
原创 2020-12-09c语言学习
计算3!+2!+1!#include <stdio.h>int main(){int i = 0;int ret = 1;int sum = 0;int n = 0;for (n = 1; n <= 3; n++){ ret = ret*n; sum = sum + ret;}printf("sum= %d", sum);return 0;}
2020-12-09 09:15:16 129
原创 2020-12-08c语言学习
while循环语句#include <stdio.h>int main(){int ch = 0;while ((ch = getchar()) != EOF){putchar(ch);}return 0;
2020-12-08 10:47:42 111
原创 选择语句
#include <stdio.h>int main(){int coding = 0;printf(“你会去敲代码吗?(选择1 or 0) :>”);scanf("%d", &coding);if (coding == 1){printf(“坚持,你会有好offer\n”);}else{printf(“放弃,回家卖红薯。\n”);}return 0;}...
2020-12-01 10:41:29 75
原创 循环语句
#include <stdio.h>#include <string.h>int main(){int line = 0;printf(“加入比特\n”);while (line < 20000){ printf("敲一行代码:%d\n", line); line++;}if (line >= 20000) printf("好offer\n");return 0;}
2020-12-01 10:34:27 67
原创 2020-12-01加法函数
#include <stdio.h>int Add(int x, int y){int z = x + y;return z;}int main(){int sum = 0;int a = 100;int b = 200;sum = Add(a, b);printf(“sum=%d\n”, sum);}
2020-12-01 10:27:53 63
原创 找到“单身狗”
#include <limits.h>int main(){ int arr[] = { 1, 2, 3, 4, 5, 1, 2, 3, 4 }; int i = 0; int sz = sizeof(arr) / sizeof(arr[0]); for (i = 0; i < sz; i++) { int count = 0; int j = 0; for (j = 0; j < sz; j++) { if (arr[i] == arr[j]
2020-11-28 16:38:31 124 1
原创 新手_乘法口诀表
2020_11_28_九九乘法表:#include<stdio.h>int main(){int i = 0;for (i = 1; i <= 9; i++){int j = 0;for (j = 1; j <= i; j++){printf("%d*%d=%d", i, j, i*j);}printf("\n");}return 0;}
2020-11-28 14:47:34 124
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人