摘要: #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++; i++; } printf("大写字母个 阅读全文
posted @ 2021-11-25 12:13 谭飞 阅读(13) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> main() { double m[8]; int i; for(i=0;i<=7;i++) scanf("%lf",&m[i]); for(i=7;i>=0;i--) printf("%f",m[i]); } #include<stdio.h> main() { 阅读全文
posted @ 2021-11-25 12:12 谭飞 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1、定义一个含有8个存储单元的实行数组,从键盘上接收数,然后逆序输出 #include <stdio.h> main() { int a[8],i,j; for( i=0;i<8;i++ ) { printf( "请输入第 %d数字",i+1 ); scanf( "%d",&a[i] ); } fo 阅读全文
posted @ 2021-11-25 12:10 谭飞 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1. 猜数字:随机产生一个0-99的数,猜猜看如果大了就提示大了点如果小了就提示小了点直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,n; srand((unsigned)time( 阅读全文
posted @ 2021-11-25 12:09 谭飞 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1.输出图形 #include <stdio.h> main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } } 2.输出图形 #include <stdio.h> main() 阅读全文
posted @ 2021-11-25 12:08 谭飞 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1、使用while语句求和sum=1+3+5+……+21 #include<stdio.h> main() { int a=1,sum=0; while(a<=21){ if (a%2!=0){ printf("%d ",a); sum+=a; } a++; } printf("\n从1到21的奇数 阅读全文
posted @ 2021-11-25 12:06 谭飞 阅读(7) 评论(0) 推荐(0) 编辑
摘要: .编写程序判断n是正数还是负数 #include <stdio.h> main() { double n; printf("请输入一个值n="); scanf("%lf",&n); if (n>0){ printf("n是正数"); }else if (n<0){ printf("n是负数"); } 阅读全文
posted @ 2021-11-25 12:03 谭飞 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 输入两个数字,输出较大的数字。 #include <stdio.h> main() { int m,n; printf("请输入两个数字"); scanf("%d,%d",&m,&n); if(m>n) printf("%d",m); else printf("%d",n); } 2.请输入一个数字 阅读全文
posted @ 2021-11-25 11:59 谭飞 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用scanf()函数接收整型、实型、字符型的变量,并分行依次输出。 #include<stdio.h> main() { int a; float b; char c; scanf("%d %f %c",&a,&b,&c); printf("%d\n%f\n%d\n",a,b,c); 阅读全文
posted @ 2021-10-17 21:49 谭飞 阅读(34) 评论(0) 推荐(0) 编辑