11 2021 档案

摘要:1.编写程序,统计字符串中大写字母的个数 #include<stdio.h> main(){ char str[20]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') { if(str[i]>='A'&&str[i]<='Z') cnt++; 阅读全文
posted @ 2021-11-25 19:46 杨宇喆 阅读(18) 评论(0) 推荐(0)
摘要:1.用循环求字符串长度 #include<stdio.h> #include<string.h> main(){ int i=0; char str[50]="wo ai c yuyan"; while(str[i]!='\0'){ i++; } printf("%d\n",i); } 2.编写程序 阅读全文
posted @ 2021-11-25 19:43 杨宇喆 阅读(9) 评论(0) 推荐(0)
摘要:1.编写程序,求1-1/2+1/3-1/4+…-1/100. #include<stdio.h> int main(){ double sum; int i, m; for (i = 1, m = 1, sum = 0; i <= 100; i++) { sum += m * (1.0 / i); 阅读全文
posted @ 2021-11-12 23:34 杨宇喆 阅读(46) 评论(0) 推荐(0)
摘要:1.编写程序,求1-1/2+1/3-1/4+…-1/100. #include<stdio.h> int main(){ double sum; int i, m; for (i = 1, m = 1, sum = 0; i <= 100; i++) { sum += m * (1.0 / i); 阅读全文
posted @ 2021-11-12 23:25 杨宇喆 阅读(22) 评论(0) 推荐(0)
摘要:输出正三角 #include<stdio.h> main(){ int i,j; for(i=1;i<=6;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } 输出倒三角 #include<stdio.h> main(){ int i,j; 阅读全文
posted @ 2021-11-12 23:18 杨宇喆 阅读(44) 评论(0) 推荐(0)