摘要: #include<stdio.h> #include<stdlib.h> //题目:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和 int main(){ int i,n; float a,b,s,t; while(1){ printf("请输入相加项数:"); scanf("%d",&n); s=0; a=2; b=1; for(i=1;i<=n;i++){ 阅读全文
posted @ 2019-08-26 08:54 狗狗王 阅读(2278) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 //题目:打印菱形 4 5 int main(){ 6 int a,b,x,y; 7 x=8; 8 y=8; 9 for(a=1;a<=13;a++){ 10 for(b=1;b<=15;b++) 11 if(b==x||b==y) 12 printf("*"); 13 ... 阅读全文
posted @ 2019-08-26 05:41 狗狗王 阅读(385) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> //两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。已抽签决定比赛名单。有人向队员打 //听比赛的名单。a说他不和x比,c说他不和x,z比,请编程序找出三队赛手的名单。 int main(){ int x=1,y=2,z=3,a,b,c; for(a=1;a<=3;a++) for(b=1;b<= 阅读全文
posted @ 2019-08-25 21:22 狗狗王 阅读(662) 评论(0) 推荐(0)
摘要: #include #include int main(){ int n,i; float s,l; while(1){ printf("请输入天数"); scanf("%d",&n); printf("请输入剩余桃子的个球"); scanf("%f",&l); for(i=1;i<=n;i++){ s=(l+1)*2; l=s; if(i<n) printf("第%d天剩余%f个桃子\n",... 阅读全文
posted @ 2019-08-24 20:43 狗狗王 阅读(828) 评论(0) 推荐(0)
摘要: 本题扩展为不固定高度不固定次数(系统输入) 阅读全文
posted @ 2019-08-23 20:46 狗狗王 阅读(928) 评论(0) 推荐(0)
摘要: #include #include #include /*题目:一个数如果恰好等于除开它本身外的因子之和,这个数就称为“完数”。例如6=1+2+3.编程找出1000以内的所有完数*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 lines=30"); //固定显示框尺寸 /... 阅读全文
posted @ 2019-08-23 17:55 狗狗王 阅读(833) 评论(0) 推荐(0)
摘要: #include #include #include /*题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加) ,几个数相加有键盘控制。*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 l... 阅读全文
posted @ 2019-08-23 17:54 狗狗王 阅读(3604) 评论(0) 推荐(0)
摘要: #include #include /*题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 lines=30"); //固定显示框尺寸 /*******************************... 阅读全文
posted @ 2019-08-23 17:53 狗狗王 阅读(3865) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> /*题目:输入两个正整数m和n,求其最大公约数和最小公倍数*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 lines=30"); //固定显示框尺寸 /************************************ 阅读全文
posted @ 2019-08-23 17:52 狗狗王 阅读(4951) 评论(0) 推荐(0)
摘要: #include #include /*题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A 表示,60-89 分之间的用B 表示,60分以下的用C表示*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 lines=30"); //固定显示框尺寸 /***************... 阅读全文
posted @ 2019-08-23 17:51 狗狗王 阅读(1213) 评论(0) 推荐(0)