摘要:
//题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? //1.程序分析: 兔子的规律为数列1,1,2,3,5,8,13,21.... //2.程序源代码: #include "stdio.h" mai 阅读全文
摘要:
//题目:输入某年某月某日,判断这一天是这一年的第几天? //1.程序分析:以3月5日为例,应该先把前两个月的加起来,然后再加上5天即本年的第几天,特殊情况,闰年且输入月份大于3时需考虑多加一天。 //2.程序源代码: #include "stdio.h" main() { int day,mont 阅读全文
摘要:
//题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60 阅读全文
摘要:
//题目:一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少? //1.程序分析:在10万以内判断,先将该数加上100后再开方,再将该数加上268后再开方,如果开方后的结果满足如下条件,即是结果。请看具体分析: //2.程序源代码: #include "math 阅读全文
摘要:
#include <stdio.h> main() { 【1】 ch[80]; int i; printf("请输入一个字符串:"); gets(【2】); for(i=0;ch[i]!= '【3】';i++) { if(ch[i]>='A'【4】ch[i]<='Z') ch[i]=ch[i]+32 阅读全文
摘要:
#include <stdio.h> main() { int year,flag; printf("请输入年份:"); 【1】; 【2】 printf("年份超出范围。"); else { if(year%4==0) { 【3】 { if(year%400==0) flag=1; 【4】 flag 阅读全文
摘要:
//题目:编程求输出所有符合以下特点4位数,这个数是否具有以下特点:这数本身是平方数,且其低2位和高2位所组成的2个2位数也是平方数。 //要求:使用程序中定义的变量 #include <stdio.h> #include <math.h> main(){ int qw,bw,sw,gw; // q 阅读全文
摘要:
#include "stdio.h" //有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? 每行显示5个 main() { int i,j,k,count=0; for(i=1;i<5;i++) for(j=1;j<5;j++) for (k=1;k<5;k++) { i 阅读全文