摘要:
输入一个三位数,求个位,十位,百位 #include<stdio.h> main() { int a; printf("输入一个三位数"); scanf("%d",&a); printf("个位是:%d\n十位是:%d\n百位是%d\n",a/100,a%100/10,a%10); } 2.输入一个 阅读全文
摘要:
1.编写程序,统计字符串中大写字母的个数#include <stdio.h> main() { char str[80]; int i=0; int cnt=0; printf("请输入你的字母:"); gets(str); while ( str[i]!=0 ) { if ( str[i]>='A 阅读全文
摘要:
编写程序,统计字符串中大写字母的个数 #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++; 阅读全文
摘要:
定义一个含有8个存储单元的实行数组,从键盘上接收数,然后逆序输出。 #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 阅读全文
摘要:
1.编写程序,求1-1/2+1/3-1/4+……+1/99-1/100的值 #include<stdio.h> main() { int s; double sum,t,d; sum=1.0; d=2.0; s=1; while(d<=100) { s=(-1)*s; t=s*(1/d); sum= 阅读全文
摘要:
1.输出正三角 #include<stdio.h> main(){ int i,j; for(i=1;i<=6;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } 2.输出倒三角 #include<stdio.h> main(){ int 阅读全文