随笔分类 -  C

摘要:#include <stdio.h> #include <ctype.h> int main() { char ch; printf("input a character:");//输入一个字符 scanf_s("%c", &ch); if (isalnum(ch))//判断输入字符是否为字母或数字 阅读全文
posted @ 2023-02-28 20:26 Travelever 阅读(20) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> #define MAX 200 int a[MAX],b[MAX],c[MAX]; char s1[MAX],s2[MAX]; int main() { gets(s1); gets(s2); int lens1,lens 阅读全文
posted @ 2023-02-28 20:13 Travelever 阅读(51) 评论(0) 推荐(0)
摘要:判断一个数是否为素数 #include <stdio.h> int main() { int n,i=1; printf("请输入n的值:\n"); scanf("%d",&n); //此处可用i <= n^(1/2)进行优化 for(i=1;i<n-1;i++)//从1开始也可以判读1不是素数 i 阅读全文
posted @ 2023-02-28 20:12 Travelever 阅读(124) 评论(0) 推荐(0)