02 2023 档案
摘要:#include <stdio.h> //题目:某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的,加密规则如下:每位数字都加上5,然后用和除以10的余数代替该数字,再将第一位和第四位交换,第二位和第三位交换。 //1.程序分析: //2.程序源代码: main() { int a
阅读全文
摘要:#include <stdio.h> //题目:一个偶数总能表示为两个素数之和。 //1.程序分析: //2.程序源代码: #include "stdio.h" #include "math.h" main() { int a,b,c,d; scanf("%d",&a); for(b=3;b<=a/
阅读全文
摘要:#include <stdio.h> //题目:求0-7所能组成的奇数个数。 //1.程序分析: //2.程序源代码: main() { long sum=4,s=4; int j; for(j=2;j<=8;j++)/*j is place of number*/ { printf("\n%ld"
阅读全文
摘要:#include <stdio.h> //题目:海滩上有一堆桃子,五只猴子来分。第一只猴子把这堆桃子凭据分为五份,多了一个,这只猴子把多的一个扔入海中,拿走了一份。第二只猴子把剩下的桃子又平均分成五份,又多了一个, //它同样把多的一个扔入海中,拿走了一份,第三、第四、第五只猴子都是这样做的,问海滩
阅读全文
摘要:#include <stdio.h> //题目:写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度。 //1.程序分析: //2.程序源代码: main() { int len; char *str[20]; printf("please input a string:\n")
阅读全文
摘要:#include <stdio.h> //题目:有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。 //1. 程序分析: //2.程序源代码: #define nmax 50 main() { int i,k,m,n,num[nma
阅读全文
摘要://题目:打印出杨辉三角形(要求打印出10行如下图) //1.程序分析: // 1 // 1 1 // 1 2 1 // 1 3 3 1 // 1 4 6 4 1 // 1 5 10 10 5 1 //2.程序源代码: #include <stdio.h> main() { int i,j; int
阅读全文
摘要://题目:将一个数组逆序输出。 //1.程序分析:用第一个与最后一个交换。 //2.程序源代码: #include "stdio.h" #define N 5 main() { int a[N]={9,6,5,4,1},i,temp; printf("\n original array:\n");
阅读全文
摘要://题目:有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。 //1. 程序分析:首先判断此数是否大于最后一个数,然后再考虑插入中间的数的情况,插入后此元素之后的数,依次后移一个位置。 //2.程序源代码: #include "stdio.h" main() { int a[11
阅读全文
摘要://题目:求一个3*3矩阵对角线元素之和 //1.程序分析:利用双重for循环控制输入二维数组,再将a[i][i]累加后输出。 //2.程序源代码: #include "stdio.h" main() { float a[3][3],sum=0; int i,j; printf("please in
阅读全文
摘要://题目:对10个数进行排序 //1.程序分析:可以利用选择法,即从后9个比较过程中,选择一个最小的与第一个元素交换下次类推,即用第二个元素与后8个进行比较,并进行交换。 //2.程序源代码: #include "stdio.h" #define N 10 main() { int i,j,min,
阅读全文
摘要://题目:请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母。 //1.程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或if语句判断第二个字母。 //2.程序源代码: #include "stdio.h" main() { char letter;
阅读全文
摘要://题目:给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。 //1. 程序分析:学会分解出每一位数,如下解释: //2.程序源代码: #include "stdio.h" main( ) { long a,b,c,d,e,x; scanf("%ld",&x); a=x/10
阅读全文
摘要://题目:求1+2!+3!+...+20!的和 //1.程序分析:此程序只是把累加变成了累乘。 //2.程序源代码: #include "stdio.h" main() { float n,s=0,t=1; for(n=1;n<=20;n++) { t*=n; s+=t; } printf("1+2
阅读全文
摘要://题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。 //1.程序分析:请抓住分子与分母的变化规律。 //2.程序源代码: #include "stdio.h" main() { int n,t,number=20; float a=2,b=
阅读全文
摘要://题目:两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。已抽签决定比赛名单。有人向队员打听比赛的名单。a说他不和x比,c说他不和x,z比,请编程序找出三队赛手的名单。 //1.程序分析:判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除,则表明此数不是
阅读全文
摘要://题目:猴子吃桃问题:猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。 //1.程序分析:采取逆向思维的方法,从后往前推断。 //2
阅读全文
摘要://题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高? //1.程序分析:见下面注释 //2.程序源代码: #include "stdio.h" main() { float sn=100.0,hn=sn/2; int n;
阅读全文
摘要://题目:一个数如果恰好等于它的因子之和,这个数就称为"完数"。例如6=1+2+3.编程找出1000以内的所有完数。 //1. 程序分析:请参照程序<--上页程序14. //2.程序源代码: #include "stdio.h" main() { static int k[10]; int i,j,
阅读全文
摘要://题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制。 //1.程序分析:关键是计算出每一项的值。 //2.程序源代码: #include "stdio.h" main() { int
阅读全文
摘要://题目:将一个正整数分解质因数。例如:输入90,打印出90=2*3*3*5。 //程序分析:对n进行分解质因数,应先找到一个最小的质数k,然后按下述步骤完成: //(1)如果这个质数恰等于n,则说明分解质因数的过程已经结束,打印出即可。 //(2)如果n<>k,但n能被k整除,则应打印出k的值,并
阅读全文
摘要://题目:古典问题:有一对兔子,从出生后第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
阅读全文
摘要:#include <stdio.h> //任意输入两个整数,输出这两个数的最小公倍数 main() { int a,b,c,gys,gbs; scanf("%d%d",&a,&b) ; for(c=1;c<=a*b;c++) { if(c%a==0&& c%b==0) { gbs=c; break;
阅读全文
摘要://原数据状态 des // Contains data from D:\Stata17\ado\base/a/auto.dta // Observations: 74 1978 automobile data // Variables: 12 13 Apr 2020 17:45 // (_dta
阅读全文
摘要://检测所有能通过ssc安装的以d开头的命令列表 ssc describe d // // http://fmwww.bc.edu/repec/bocode/d/ // (no title) // // // PACKAGES you could -net describe-: // d3netwo
阅读全文
摘要:sysuse auto, clear // (1978 automobile data) des // // Contains data from D:\Stata17\ado\base/a/auto.dta // Observations: 74 1978 automobile data // V
阅读全文
摘要:/*程序功能: 输入一个不大于4位正整数,判断它是几位数,然后输出各位之积。*/ #include <stdio.h> main() { int a,【1】,【2】,b; scanf("%d",&a); 【3】=a; if(【4】) { do{ wei++; cj=【5】; a=【6】; }whil
阅读全文
摘要:#include <stdio.h> // 实现两个字符串的连接(不使用库函数),即把字符串s2连接到字符串s1的后面 【1】 main() { char s1[80],s2[20]; int 【2】,【3】; 【4】(s1); 【5】(s2); while(【6】) { i++; } while(
阅读全文
摘要:检测变量名filter观测值不连续,而filter2观测值是连续的 list filter2 if filter2!=(filter2[_n-1]+1) in 2/L //检测变量名filter2的值是否连续: //如果所有的取值是连续的,那么当前记录的在变量filter2上的值应该等于其前一条记录
阅读全文
摘要:#include <stdio.h> //<<九章算术>>更相减损法: 可以用来求两个数的最大公约数,即“可半者半之,不可半者,副置分母、子之数,以少减多,更相减损,求其等也。 //以等数约之。 ///第一步:任意给定两个正整数;判断它们是否都是偶数。若是,则用2约简;若不是则执行第二步。 //第二
阅读全文
摘要:#include <stdio.h> //求最大公约数:辗转相除法:辗转相除法是求两个自然数的最大公约数的一种方法,也叫欧几里德算法。 //319 377:319%377=319 377%319=58 319%58=29 58%29=0 29为最大公约数 int gys(int a,int b) {
阅读全文
摘要:sysdir // STATA: D:\Stata17\ stata17安装位置 // BASE: D:\Stata17\ado\base\ stata官方命令 // SITE: D:\Stata17\ado\site\ // PLUS: C:\Users\Administrator\ado\plu
阅读全文
摘要:Relational Arithmetic Logical (numeric and string) + addition & and > greater than - subtraction | or < less than * multiplication ! not >= > or equal
阅读全文
摘要:变量抽取 sample 10,count//简单随机抽样,抽取10个观测值 sample 10 if female==1,count//在女性数据中抽取10个样本并保留所有男性样本 sample 10 ,count by(female)//在男性和女性样本中各抽取10个样本 sample 5 ,co
阅读全文
摘要:变量转换 encode sex,generate(gender)//生成数值型变量gender decode gender,generate(gender2)//根据gender变量重新生成一个字符型变量gender2 recode x2(1 2=1)(3=2)(4/7=3),gen(nx2)//改
阅读全文
摘要:bysort female:egen educmed=median(educ)//赋值为educ受教育年数中位数,这项工作要求分性别进行 egen higheduc=anyvalue(educ),v(13/18)//生成一个新变量higheduc,如果educ大于12则higheduc包含这个变量的
阅读全文
摘要:list // // + + // | make price mpg rep78 headroom trunk weight length turn displa~t gear_r~o foreign | // | | // 1. | AMC Concord 4,099 22 3 2.5 11 2,
阅读全文
摘要://如果有变量ifoi则删除该变量,否则命令即结束,准备产生新变量ifoi,如果有则删除,没有则进行下一步 cap drop ifoi //使用正则表达式 //建立新变量ifoi,如果yjszyyq包含”经济"值为1,否则为0 gen ifoi=regexm(yjszyyq,"经济") if yjs
阅读全文
摘要://显示gwmc中包含“管理"的所有观测值 list if strmatch(gwmc,"*管理*") //使用正则表达式 //建立新变量ifoi,如果yjszyyq包含”经济"值为1,否则为0 gen ifoi=regexm(yjszyyq,"经济") if yjszyyq!="" indexno
阅读全文
摘要:list ,separator(3) //列表,每隔3行划线 // // + + // | make price mpg rep78 headroom trunk weight length turn displa~t gear_r~o foreign | // | | // 1. | AMC Co
阅读全文
摘要://所有缺失值都替换为9999 mvencode _all, mv(99999) override //替换换行 replace var = subinstr(var, char(10),"",.)
阅读全文
摘要:keep 序号 事业单位 主管部门举办单位 岗位类别 岗位等级 岗位性质 岗位名称 招聘人数 学历要求 学位要求 大学专科专业 要求 大学本科专业要求 研究生专业要求 其他条件要求 开考比例 笔试和面试成绩比例 咨询电话 备注 rename (序号 事业单位 主管部门举办单位 岗位类别 岗位等级 岗
阅读全文
摘要:#include <stdio.h> //输入一行英文,输出单词个数 (最开始 中间 最后可能有多个空格) #include <string.h> main() { char zf[101]; int a,b,c=0,d=0; gets(zf); a=strlen(zf); for(b=0;b<a;
阅读全文
摘要:/* 输入一个不大于4位正整数,判断它是几位数,然后输出各位之积。*/ #include <stdio.h> main() { int a,cj=1,wei=0,b; scanf("%d",&a); b=a; if(a<=9999 && a>=0) { do{ a=a%10; wei++; cj=c
阅读全文
摘要:/* 编写程序,输入一个学生的生日(年:y0、月:m0、日:d0); 并输入当前的日期(年:y1、月:m1、日:d1);输出学生的实际年龄周岁*/ #include <stdio.h> main() { int y0,m0,d0,y1,m1,d1,r; printf("请输入生日:\n"); sca
阅读全文
摘要:#include <stdio.h> //不用abs() fabs()函数输出任意整数的相反数 main() { int a,b; scanf("%d",&a); b=【1】; printf("%d的相反数为%d",a,b) ; getchar(); } #include <stdio.h> //不
阅读全文
摘要://修改变量名rename 姓名 namerename 考号 kaohaorename 班级 banji //所有变量名为大写rename *,upper//变量名kaohao为大写rename kaohao,upper //所有变量名为小写rename *,lower//变量名kaohao ban
阅读全文
摘要:stata17默认开启自己的设置:1.将自己需要的设置如 cd "d:\statashu"保存成profile.do文件,并保存在stata17的安装目录 如:D:\Stata172.重新打开stata17则自动生效,自动将d:\statashu作为当前路径
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b; srand((unsigned)time(NULL)); for(b=1;b<=100;b++) a = rand(), printf("%6
阅读全文
摘要:cd d:\statashu //导入指定文件,原表第一行作为变量名,所有变量都是字符串型 import excel "D:\statashu\期中考试学生名单.xlsx", sheet("Sheet1") firstrow all string //修改变量名 rename 姓名 name ren
阅读全文
摘要:Sub Lineups()Dim rng As RangeSet rng = Range("E2:E1501") Dim ac As RangeSet ac = Application.ActiveCell rng.Find(what:=ac).Selectac.Interior.Color = 6
阅读全文
摘要:merge 需要注意的事项: m:1 表示keyword在using文件中必须是唯一没有重复的的1:m 表示keywords在master文件中必须是唯一没有重复的 合并数据//横向1:1合并//merge 1:1 Symbol using "F:\1A研究生资料\研究生作业\石老师作业\合并数据\
阅读全文
摘要:1.头文件引用 2 变量 的定义和初始化 3 常用库函数的使用 4 运算符和表达式的使用 5 实现顺序结构程序设计 6 用if 语句 switch语句实现分支结构的程序设计 7 用while do...while for语句实现循环结构程序设计 8 一维数组 二维数组的定义 初始化及数组元素引用 9
阅读全文
摘要:#include <stdio.h> //任意输入三行四列12个整数,如果某行第1个数 2个数都大于等于55,并且第3 4个数都大于等于 90,并且该行四个数的和大于等于310则输出"YES" //否则输出"NO" int main() { float a[3][4] = {0}; int i =
阅读全文
摘要:#include <stdio.h> //任意输入999-9999之间的任意整数n,如果不在此范围内重新循环输入直到符合条件才继续运行 //输出0到n之间所有能被7 17整除但不能被2整除的数 void main() { long int n,i; printf("please input a po
阅读全文
摘要:www.pythonthree.compytubePytube 是一个小型的、无依赖性的 Python 模块,用于从 Internet 访问视频,必须先安装它才能使用它。当你有 pip 时,安装很简单。要使用 pip 安装 Pytube,您需要以管理员身份打开命令提示符 CLI 并输入以下命令: p
阅读全文
摘要:删除满足条件的观测值:drop if s>=16(慎重删除,该过程不可逆,最好做好数据备份) 保留部分观测值:keep if s>=16 按变量升序排列:sort s 然后list显示 降序:gsort -s 注意这个负号)然后list显示//批量修改ft301的值为-8的修改为0replace f
阅读全文
摘要:生成新变量:generate 1.g ln wage = log(wage) 前面是变量名,后面是代表取对数 2.g wage2=wage^2 变平方 3.g wage =edu*wage 生成wage 和 edu 的互动项 4.g w=exp(ln wage) 根据工资对数计算工资水平 5.g e
阅读全文
摘要:stata常用缺失值处理 1.删除缺失值gen missing1=missing(VAR1 VAR2)//生成虚拟变量keep if missing1==0//仅保留没有缺失值的数据2.线性插值法by id:ipolate 变量 year,gen(变量2) epolate
阅读全文
摘要://程序功能:已知有一圆环,内圆半径r1,外圆半径r2,求圆环面积(保留2位小数) 【1】 【2】 PI 3.1415926 main() { 【3】 r1,r2,area; printf("请输入内圆半径r1,外圆半径r2\n"); 【4】; if(【5】) { area=PI*(【6】); pr
阅读全文
摘要:#include <stdio.h> main() { int a,b,c,d=0,sum=0; printf("100-200间所有质数:"); for(a=100;a<=200;a++) { c=0; for(b=2;b<a;b++) if(a%b==0) { c=1; break; } if(
阅读全文
摘要:#include <stdio.h> /*程序功能:从键盘输入4组字符,每组字符数量为3个,字符之间用空格隔开; 编程将每组字符按ASCII码由小到大的顺序输出。 例如: 请输入第1组字符: q a z 第1组字符按ASCII码由小到大依次为:a q z …… …… 请输入第4组字符: w e r
阅读全文
摘要:#include <stdio.h> //计算用1分钱 2分钱 5分钱组成1元钱的方式 //要求三种钱都必须有,共有多少种组成方式,并输出相应的组成方式 //【1】【2】【3】填写最小的可能的数 main() { int a,b,c,d=0; for(a=1;a<【1】;a++) for(b=1;b
阅读全文
摘要:#include <stdio.h> //s=1+2+6/4+10/6+16/10+26/16+.....前30项的和 main() { int i,t; float a=【1】,b=【2】,s=【3】; for(i=1;i<=【4】;i++) { s=【5】; t=【6】; a=【7】; b=t;
阅读全文
摘要:#include <stdio.h> 【1】 //逆序输出任意字符串 void severse_string(char arr【2】) { int len = strlen(arr); int left = 0; int right = len - 1; while (left < right) {
阅读全文
摘要:#include <stdio.h> 【1】 //逆序输出任意字符串 void severse_string(char【2】str) { int len = strlen(str); char* left = str; char* right = str + len - 1; while (left
阅读全文
摘要:#include <stdio.h> //逆序输出任意字符串 【1】 main() { char zf[100]; int a,b; 【2】; a=【3】; for(b=a-1;b>=0;b--) printf("%c",zf[b]); getchar(); } #include <stdio.h>
阅读全文
摘要:#include <stdio.h> //从键盘输入一个整数,如果不高于100则逆序输出,否则输出"输入范围错误" 【1】 nx(int n) { while(n) { printf("%d",【2】); 【3】; } printf("\n"); } main() { int shu,a,b; 【4
阅读全文
摘要:#include <stdio.h> //求n的阶乘 long factorial(int n) { if (n == 0 || n == 1) { return 1; } else { return factorial(n - 1) * n; // 递归调用 } } long jc(int n)
阅读全文
摘要:#include <stdio.h> //从整体上看,C语言代码是由一个一个的函数构成的,除了定义和说明类的语句(例如变量定义、宏定义、类型定义等)可以放在函数外面, //所有具有运算或逻辑处理能力的语句(例如加减乘除、if else、for、函数调用等)都要放在函数内部。 int a = 10;
阅读全文
摘要://如果要规定上下限:a b(b>a) /// rand() %(b-a+1) + a; //产生a~b的随机数 //分析:取模即取余,rand()%51+13我们可以看成两部分:rand()%51是产生 0~50 的随机数,后面+13保证 a 最小只能是 13,最大就是 50+13=63。 //产
阅读全文
摘要:#include <stdio.h> #include <math.h> //利用公式求π:1-1/3+1/5...=π/4 //直到最后一项的绝对值小于0.000001为止 ,结果保留6位小数 int main(){ float s=1; float pi=0; float i=1.0; floa
阅读全文
摘要:#include <stdio.h> 【1】 //利用公式求π:1-1/3+1/5...=π/4 //直到最后一项的绝对值小于0.000001为止 ,结果保留6位小数 int main(){ float s=1; float pi=0; float i=1.0; float n=1.0; while
阅读全文
摘要:Sub CheckTableCells() Application.DisplayAlerts = False Dim sht As Worksheet Dim i, j As Integer For i = 1 To 284 If (Range("e" & i).Value = "") Then
阅读全文
摘要:Sub CheckTableCells() Application.DisplayAlerts = False Dim sht As Worksheet Dim i, j As Integer For i = 1 To 284 If (Range("e" & i).Value = "") Then
阅读全文
摘要:stata变量名特别多,des显示不完整,只能看到最后一部分解决方法:第一步: ssc install des2 log using exam22a,replace text des2(显示结果复制,自动成表格,EXCEL粘贴形成表格) log close第二步:打开exam22a.log选择并复制
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b; srand((unsigned)time(NULL)); for(b=1;b<=100;b++) a = rand(), printf("%6
阅读全文
摘要:#include <stdio.h> //从键盘输入10个整数,输出这10个数的最大值 最小值 平均值 main() { int cj[10],min,max,aver,n; for(n=0;【1】;n++) scanf("%d",【2】) ; 【3】cj[0]; for(n=1;n<10;n++)
阅读全文
摘要:#include <stdio.h> //将数组中的值降序排序并输出 main() { int a[10]={12,3,5,78,98,345,23,35,67,99}; int i,j,k,t; for(i=0;【1】;i++) { 【2】; for(j=i+1;j<10;j++) if(【3】)
阅读全文
摘要:#include <stdio.h> //从键盘输入一个十进制整数,输出其二进制数 main() { int x[10],n,i,j; 【1】; scanf("%d",&n); while(【2】 { 【3】; n=【4】; 【5】; } for(【6】;j>=0;j--) printf("%d",
阅读全文
摘要:#include <stdio.h> //输出1-100间的所有除3余1且除5余2的数,每行2个 【1】 { int i,k; 【2】; for(i=1;i<=100;i++) if(【3】) { printf("%5d",i); 【4】; if(【5】) printf("\n"); } getch
阅读全文
摘要:#include <stdio.h> //输入10个学生成绩,统计高于平均分的人数 main() { 【1】 a[10],sum=【2】,pjz; 【3】 b; for(b=0;b<10;b++) { scanf("%f",【4】); sum=【5】; } pjz=【6】; 【7】; for(b=0
阅读全文
摘要:【1】 <stdio.h> //程序输出结果:3,2,2,3 【2】 fun(【3】 x,int y) { x=【4】; y=x-y; x=x-y; printf("【5】",x,y); } main() { int x=2,y=3; fun(x,y); printf("【6】",x,y); get
阅读全文
摘要:#include <stdio.h> //输出100-200间所有的素数,且一行只打印7个数 main() { int num,i,t,count; 【1】; for(num=100;num<=200;num++) { 【1】; for(i=2;i<=num-1;i++) if(【1】) { t=0
阅读全文
摘要:#include <stdio.h> //补充程序使输出结果是1,2,6,24,120 【1】 ff(int n) { 【2】 int f=1; f=【3】; return f; } main() { int i; for(i=1;【4】;i++) printf("%d,",【5】); printf
阅读全文
摘要:【1】 //全局变量与局部变量的使用 【2】d=1; 【3】 fun(int 【4】) { int d=5; d+=p++; printf("%d ",d); } main() { int a=3; 【5】;//以a为参数调用fun函数 d+=a++; printf("%d ",d); getcha
阅读全文
摘要:#include <stdio.h> //根据学生成绩输出评定等级。成绩为90-100分输出“A",成绩为80-89分输出"B" // 成绩为70-79分输出"C",成绩为60-69分输出"D",否则输出”E" main() { int cj;【1】; printf("please input st
阅读全文
摘要:#include <stdio.h> //任意输入两个整数,输出这两个数的最大公约数和最小公倍数 main() { int a,b,c,gys,gbs; scanf("%d%d",&a,&b) ; for(c=a;【1】;c--) { if(【2】) { gys=【3】; 【4】; } } gbs=
阅读全文
摘要:#include <stdio.h> #include <math.h> //根据输入的三角形的三条边判断能否组成三角形,并判断三角形的类型,并输出其面积 //三角形类型区分等边 等腰 等腰直角 直角三角形 main() { float a,b,c,mj,p; scanf("%f%f%f",&a,&
阅读全文
摘要:#include <stdio.h> //输出1980-2020年之间所有的闰年,每行三个 main() { int year,【1】,b; for(year=1980;year<=2020;year++) { 【2】; if(【3】) { printf("%5d",year); count++;
阅读全文
摘要:#include <stdio.h> //用来统计输入的字符中所有大写字母的个数,用#结束输入 main() { int a[26],i; char ch; for(i=0;i<26;i++) a[i]=【1】; ch=getchar(); while(【2】) { if(ch>=65&&ch<=9
阅读全文
摘要:#include <stdio.h> //功能:从键盘输入一个整数,如果不高于9999则逆序输出,否则打印“输入范围错误" main() { 【1】; 【2】; if(x<=9999) do{ printf("%d",【3】); 【4】; }【5】 else printf("输入范围错误"); ge
阅读全文
摘要:#include <stdio.h> //功能:从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩 //当输入负数时结束输入,请将程序补充完整 main() { float x,amax,amin; scanf("%f",【1】) ; amax=x; amin=x; while(【2】) {
阅读全文
摘要:#include <stdio.h> //求s=1-3+5-7+...-99+101并输出 main() { int i,t=1,【1】; for(i=1;【2】;【3】) { s=【4】; t=【5】; } printf("s=%d\n",s); getchar(); } 求s=1-3+5-7+.
阅读全文
摘要:#include <stdio.h> //求s=3+13+23+...+103 main() { int 【1】; for(i=0;【2】;i++) s=【2】; printf("s=【4】\n",s); getchar(); } #include <stdio.h> //求s=3+13+23+..
阅读全文
摘要:#include <stdio.h> //找出二维数组中的最大值,并输出所有最大值对应的行与列 main() { int a[5][5]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,24,24,15,16,21,17,18,19,24,22,23} ,max,hang,lie,
阅读全文
摘要:#include <stdio.h> //求二维数组中的最大值及对应的行号与列号 main() { int a[5][5]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,24,15,16,21,17,18,19,20,22,23} ,max,hang,lie,c,b; ma
阅读全文
摘要:=IF(ISNUMBER(FIND("经济学",M1)),1,0) 判断单元格m1中是否包含“经济学”,如果包含值为1,不包含值为0=IF(ISNUMBER(FIND("党员",N1)),1,0)判断单元格n1中是否包含“党员”,如果包含值为1,不包含值为0=IF(AND(S1=1,T1=0),1,
阅读全文
摘要:#include <stdio.h> //变量作用域:局部变量 全局变量 //函数外声明的变量称为全局变量,函数内声明的变量的称为局部变量 //变量生存周期:变量的存在时间 //静态存储方式:指在程序运行期间分配固定的存储空间 //动态存储方式:指在程序运行期间根据需要动态分配存储空间 //c语言程
阅读全文
摘要:#include <stdio.h> //利用指针排序 main() { int a[6]={6,5,4,3,2,1},i,j,k; int *p[6],*t; for(i=0;i<6;i++) p[i]=&a[i]; for(i=0;i<6;i++) { k=i; for(j=i+1;j<6;j+
阅读全文
摘要:#include <stdio.h> //假期小王跟随父亲去钓鱼,小王的父亲在这期间钓到了一条大鱼距离岸边 l 米,小明的父亲每5分钟向岸边收m米,然后休息 2分钟,这时鱼会向外游出n米, //试编写一个函数:对于任意指定的l,m,n值,试问小王父亲多少分钟可以把这条鱼钓上岸。 float sja(
阅读全文
摘要:vba 判断单元格内容是否为汉字=if(lenb(d1)<>len(d1),1,0)1为汉字0不是汉字
阅读全文
摘要:Sub CheckTableCells() Application.DisplayAlerts = False Dim sht As Worksheet Dim i, j As Integer For i = 1 To 10000 If (Range("e" & i).Value = "") The
阅读全文
摘要:#include <stdio.h> //数组a中有8个不相等的元素,b中有5个不相等的元素,数组c中包含那些a中但不在b中的元素,并输出数组c各元素的值 main() { int a[8],b[5],i,j,count; 【1】 for(i=0;i<8;i++) 【2】 for(i=0;i<5;i
阅读全文
摘要:如何把更改的驱动器图标改成默认图标?在驱动器的根目录下找到 desktop.ini (是一个隐藏文件),删除这个文件,驱动器的图标就变回默认的了。
阅读全文
摘要:#include <stdio.h> #include <math.h> main() { float s=1,pi=0,i=1.0,n=1.0; while(fabs(i)>=1e-6) { pi+=i; n=n+2; s=-s; i=s/n; } pi=4*pi; printf("pi的值是:%
阅读全文
摘要:#include<stdio.h> main() { int shu[10]={0},su,max[2]; while((su=getchar())!='\n') shu[su-48]++; for(su=1,max[1]=0;su<10;su++) if(shu[su]>=max[1]) max[
阅读全文
摘要:#include <stdio.h> main() { int n,a,b=0,c; scanf("%d",&n); printf("%d=1*",n); for(a=2;a<n;a++) {c=0; if(n%a==0) printf("%d",a),b++,c=1; if(b%2==1&& c=
阅读全文
摘要:#include <stdio.h> main() { int n; while(~scanf("%d",&n)) { printf("%d\n",n); if(n==0) break; } getchar(); }
阅读全文
摘要:#include<stdio.h> int main() { int m,i,count=0;//定义一个正整数m,因子i,因子计数count,刚开始因子为0; printf("请输入一个正整数:\n"); scanf("%d",&m); for(i=1;i<=m;i++)//用for循环来从1因子
阅读全文
摘要://求最小公倍数 //两个或多个整数公有的倍数叫做它们的公倍数,其中除0以外最小的一个公倍数就叫做这几个整数的最小公倍数。 #include <stdio.h> main() { int m,n,i,k,max,min; scanf("%d,%d",&m,&n); max=m>n?m:n; min=
阅读全文
摘要:#include <stdio.h> main() { int a[20],i,b,c; for(i=0;i<=19;i++) a[i]=rand()%90+10; for(i=0;i<=19;i++) printf("%d ",a[i]); getchar(); }
阅读全文
摘要:#include <stdio.h> //两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。 //已抽签决定比赛名单,有人向队员打听比赛的名单。a说他不和x比, //c说他不和x、z比,请完成程序填空,实现找出三队赛手的名单。 main() { char i,j,k;//i
阅读全文
摘要:#include <stdio.h> //求s=1+1/3+1/5+....之和,直到某一项的值小于10的-6次方时停止累加 main() { float a=1,【1】,b,c; while(【2】) { s=s+【3】; a=【4】; } printf("%f\n",s); getchar();
阅读全文
摘要:#include <stdio.h> // 一个小球从100米高度自由下落,每次落地后反跳回原来高度的一半,再下落, //求它在第十次下落地时,共经过多少米,第十次反弹多高? main() { float 【1】,sum,i=1; sum=【2】; while(i<=10) { height=hei
阅读全文
摘要:#include <stdio.h> //将字符数组a的全部字符复制到字符数组b中(要求不用strcpy函数) //并输出新字符串 【1】 main() { char a[100],b[100]; int c,d,f; 【2】; c=【3】; for(d=0;【4】;d++) b[d]=【5】; b
阅读全文
摘要:#include <stdio.h> //输入一个字符串(20个字符以内),判断其是否是回文字符串(回文字符串是指正反一样的字符串)。 【1】 main() { char a[21]; int b,【2】,len; 【3】; len=【4】; for(b=0;b<(len-1)/2;b++) if(
阅读全文
摘要:#include <stdio.h> //鸡兔同笼问题,兔子和鸡同处一个笼子,头的数量为x,脚的数量为y,输人x和y,输出鸡多少只兔子多少只(如输人错误则输出“输入非法!”)。 main() { int x,y,ji,tu,【1】; scanf("%d%d",【2】); for(ji=1;ji<=【
阅读全文
摘要:#include <stdio.h> 【1】 //输人一行字符串,由英语单词和若干空格组成,将每个单词的第一个字母不是大写的变为大写并输出。 main() { char ch[100]; int i=0,n=0; 【2】; while(【3】) { if(i==0) { if(ch[i]>='a'&
阅读全文
摘要:#include <stdio.h> //3个候选人,每个选民只能投票选一人,要求编一个统计选票的程序,先后输人被选人的名字,最后输出各人得票结果。 【1】 struct person{ char name[20];int count; }leaders[3]={"zhang",0,"wang",0
阅读全文
摘要://以下程序的输出结果如图所示,每行的最左和最右元素均为1, //中间的每个元素等于其左上方和上方两个元素之和,每个元素的宽度为4且左对齐。请完成程序填空。 #include<stdio.h> main() { int a[8][8],i,j; for(i=0;i<8;i++) { a[i][0]=
阅读全文
摘要://.要输出图形tu.png样式,请完善程序。 #include <stdio.h> main() { int i,j,k; for(i=1;【1】;i++) { for(j=1;【2】;j++) 【3】; for(k=1;【4】;k++) printf("%2d",i); 【5】; } } //.
阅读全文
摘要://已有一个已经排好序的序列,输入一个数,将其插入到该序列中,使之仍然保持有序。 #include <stdio.h> main() { int a[20]={3,7,10,12,18,20}; int i,j,t; scanf("%d",【1】); for(i=0;【2】;i++) for(【3】
阅读全文
摘要://输入十个评委的打分,去掉一个最高分,去掉一个最低分,求平均分。 # include<stdio.h> main() { int mark,max,min,sum=0,i; 【1】; for(i=1;i<=10;i++) {scanf("%d",&mark); if(【1】) {max=mark;
阅读全文
摘要://输入一个日期,输出是本年的第几天。 # include <stdio.h> main() { int year,month,day,i; scanf("%d%d%d",&year,&month,&day); for(i=1;i<=【1】;i++) { if(i==4 ||i==6||i==9||
阅读全文
摘要://冒泡排序:将任意10个浮点数从小到大排序 #include <stdio.h> main() { float a[10],t; int i,j,k,b; for(i=0;i<=9;i++) scanf("%f",&a[i]); for(i=0;i<=9;i++) { for(j=0;j<9-i;
阅读全文
摘要:#include <stdio.h> //程序运行结果:【1】 int *f(int *x,int *y) { if(*x<*y) return x; else return y; } main() { int a=7,b=8,*p=&a,*q=&b,*r; r=f(p,q); printf("%d
阅读全文
摘要:#include <stdio.h> //http://www.china-audit.com/lhd_4awla5u6mp47ty70kclt55mbv23rb1005bb_1.html //实现输入两个数字,若两数相等,则直接输出两个数字;若不相等,则这两个数中的 //较大者等于这个较大者减去较
阅读全文
摘要:#include <stdio.h> //键盘输入任意整数,判断其是否为质数 int pdzs(int n) { int a; if(n==1) return 0; for(a=2;a<n;a++) if(n%a==0) return 0; return 1; } main() { int a=1,
阅读全文
摘要:#include <stdio.h> //输入5个1-9之间的整数,输出由这五个数能组成的最大值和最小值。 main() { int a[5],i,j,temp,【1】; for(i=0;i<5;i++) scanf("%d",&a[i]); for(i=0;i<4;i++) for(j=【2】;j
阅读全文
摘要:#include <stdio.h> //输入一行英文,输出单词个数 //输入一行字符串,由英语单词和若干空格组成,输出单词个数。(约定第一个单词前和最后一个单词后没有空格,输入最多100个字符) #include <string.h> main() { char zf[101]; int a,b,
阅读全文
摘要:#include <stdio.h> //输人一个5行5列的二维数组,将其按行存储在一个一维数组中并输出。 main() { int a[5][5],b[25],c,d,e=0; for(c=0;c<5;c++) for(d=0;d<5;d++) { scanf("%d",&a[c][d]); b[
阅读全文
摘要:#include <stdio.h> //哥德巴赫猜想是指任一大于2的偶数都可写成两个素数之和,请输入任何一个大于2的偶数,将其分解为两个素数之和并输出, //输出格式如下:如输入8,则输出:8=3+5,有多个结果的只输出一个即可,注意1不是素数,故不能输出8=1+7, //如输入非法则给出提示,本
阅读全文
摘要:#include <stdio.h> //程序功能:将任意字符串转置并输出 #include <【1】> main() { char c[20]; int i=0,j; char ch; 【2】; j=【3】; while(【4】) { ch=c[i]; c[i]=c[j-1]; c[j-1]=ch
阅读全文
摘要:#include <stdio.h> //a b c均为一位整数,求当三位整数abc+cba=1333时的a,b,c的值 main() { int a,b,c; for(a=1;【1】;a++) for(【2】;b<=9;b++) for(【3】;c<=9;c++) if(【4】) printf("
阅读全文
摘要:#include <stdio.h> //程序功能: 判断输入字符串是不是手机号 //【1】写最少的数 #include <string.h> main() { char zf[【1】],ch; int a,【2】,c; 【3】; c=【4】; if(【5】 || 【6】) b=1; for(a=0
阅读全文
摘要:#include <stdio.h> //键盘输入任意整数,判断其是否为质数 int pdzs(int n) { int a; for(a=2;a<n;a++) if(n%a==0) 【1】; 【2】; } main() { int a; scanf("%d",&a); if(【3】) printf
阅读全文
摘要:#include <stdio.h> //<<九章算术>>更相减损法: 可以用来求两个数的最大公约数,即“可半者半之,不可半者,副置分母、子之数,以少减多,更相减损,求其等也。 //以等数约之。 ///第一步:任意给定两个正整数;判断它们是否都是偶数。若是,则用2约简;若不是则执行第二步。 //第二
阅读全文
摘要:#include <stdio.h> //求最大公约数:辗转相除法:辗转相除法是求两个自然数的最大公约数的一种方法,也叫欧几里德算法。 //319 377:319%377=319 377%319=58 319%58=29 58%29=0 29为最大公约数 main() { int a=319,b=3
阅读全文
摘要://求最大公约数 #include <stdio.h> int gys(int m,int n) { int i,k; k=【1】?m:n; for(i=k;i>=1;i--) { if(【1】) { return 【1】; break; } } } main() { int m,n,i,k; sc
阅读全文
摘要://求最大公约数 #include <stdio.h> main() { int m,n,i,k; scanf("%d,%d",【1】); k=【2】?m:n; for(i=k;i>=1;i--) { if(【3】) { printf("最大公约数为%d\n",【4】); break; } } ge
阅读全文
摘要:#include <stdio.h> //计算1到5的阶乘和,并将结果保存到变量s中 main() { int a,s=【1】,b=【2】; for(a=1;a<=【3】;a++) { b=b*a; s【4】=【5】; } printf("1-5阶乘的和为:%d",s); getchar(); }
阅读全文
摘要:#include <stdio.h> //执行程序段后,变量s的值为() main() { int a=10,s=0; do { s=s+a; a++; } while(a<1); getchar(); } #include <stdio.h> //执行程序段后,变量s的值为(10) main()
阅读全文
摘要:#include <stdio.h> //求s=1+2+3+4+...+100 main() { int a=101,【1】; while(【2】,a>0) s【3】=【4】; printf("s=%d",s); getchar(); } #include <stdio.h> //求s=1+2+3+
阅读全文
摘要:#include <stdio.h> //执行下列程序段后,y的值是(),x的值是(), m的值是(),n的值是() main() { int x,y,z,m,n; m=10;n=5; x=(--m==n++)?--m:++n; y=m++; getchar(); } #include <stdio
阅读全文
摘要:#include <stdio.h> //求两个数中的最大值 int max(int a,int b) { return 【1】; } main() { int a,b; scanf("%d%d",【2】); printf("max=%d",【3】); getchar(); } #include <
阅读全文
摘要:#include <stdio.h> //求任意整数的阶乘 //如果输入3则输出3!=6 main() { int n,a,c=1; scanf("%d",&n); for(a=1;【1】;a++) c=【2】; printf("%d!=%d",【3】); getchar(); } #include
阅读全文
摘要:#include <stdio.h> //找出100-999间所有的Armstrong数 //Armstrong数:指这个3位数各位上数字的立方和等于自身 //371=3*3*3+7*7*7+1*1*1 main() { int i,a,b,c; for(i=100;i<=999;i++) { a=
阅读全文
摘要:#include <stdio.h> //求出a中各相邻两个元素的和,并将这些和存放在数组b中 //按每行3个元素的形式输出。例如:b[1]=a[1]+a[0],....,b[9]=a[9]+a[8] main() { int a[10],b[10],i; printf("\nInput 10 nu
阅读全文
摘要:#include <stdio.h> //输入一行英文,输出单词个数 #include <string.h> main() { char zf[101]; int a,b,【1】; 【1】; a=【1】; for(b=0;【1】;b++) if(zf[b]==【1】) c++; c=【1】; pri
阅读全文
摘要:#include <stdio.h> //输入5个1-9之间的整数,输出其中的最大值和最小值 main() { int a[5],i,j,temp,【1】; for(i=0;i<5;i++) scanf("%d",&a[i]); for(i=0;i<4;i++) for(j=【1】;j<5;j++)
阅读全文
摘要:#include <stdio.h> //从键盘输入一个年份和月份,输出该月的天数 main() { int year,month; scanf("【1】",&year,&month); switch(month) { case 1: case 3: case 5: case 7: case 8:
阅读全文
摘要:#include <stdio.h> //调用函数f,从字符串中删除所有的数字字符 asdf32asdfadsfds\0 数组 #include <string.h> void f(char *s) { int i=0; while(【1】) { if(s[i]>='0' && s[i]<='9')
阅读全文
摘要:#include <stdio.h> //调用函数计算代数多项式1.1+2.2*x+3.3*x*x+4.4*x*x*x+5.5*x*x*x*x //当x=1.7时的值 float f(float,float*,int) ; main() { float b[5]={1.1,2.2,3.3,4.4,5
阅读全文
摘要:#include <stdio.h> //程序功能:调用函数f,将一个整数首尾倒置 //如程序输入12345,则输出54321 // 如程序输入-12345,则输出-54321 #include <math.h> int f(int n) { int m,y=0;m=abs(n); while(m!
阅读全文
摘要:#include <stdio.h> //编写一个程序,输出1-1000间所有完全数 //如果一个数等于它的因子之和,则称该数为完数或完全数 //例如6=1+2+3,因此6是完数 int wqs(int n) { int a=0,b; for(b=1;【1】;b++) if(【2】) a=a+b;
阅读全文
摘要:#include <stdio.h> //编写一个程序,输入一个整数n,判断其是否为完数 //如果一个数等于它的因子之和,则称该数为完数或完全数 //例如6=1+2+3,因此6是完数 main() { int i,n,s; 【1】; scanf("%d",&n); for(i=1;【2】;i++)
阅读全文
摘要:#include <stdio.h> //->是一个整体,它是用于指向结构体子数据的指针,用来取子数据。 //换种说法,如果我们在C语言中定义了一个结构体,然后申明一个指针指向这个结构体, //那么我们要用指针取出结构体中的数据,就要用到->。 //计算四位学生的平均成绩,保存在结构体中,然后列表输
阅读全文
摘要:#include <stdio.h> //将字符串的所有的字符's'删除 ,并输出修改后的字符串 main() { char a[80]; int i,j; 【1】; for(【2】;a[i]!=【3】;i++) if(a[i]!='s') { 【4】=a[i]; j++; } a[j]=【5】;
阅读全文
摘要:#include <stdio.h> //数列的第1 2项值为1,此后各项值均为该项前二项之和,计算数列第30项的值 int f(int n); main() { printf("%d",【1】); getchar(); } int f(int n) { if(n==1 || n==2) 【2】;
阅读全文
摘要:#include <stdio.h> //将任意三个整数按 从小到大排序 void swap(【1】,【2】) { int temp; temp=*pa; *pa=*pb; *pb=temp; } main() { int a,b,c,temp; scanf("%d%d%d",&a,&b,&c);
阅读全文
摘要:#include <stdio.h> //求输入的整数各位数字之和。如输入234则输出9;输入-123则输出6 main() { int n,【1】; scanf("%d",&n) ; n=【2】; while(【3】) { s=s+【4】; n=【5】; } printf("%d",s); get
阅读全文
摘要:#include<stdio.h> //将任意10进制整数转化为2-16任意进制 int main() { char ku[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int zh[32],i=0,w,
阅读全文
摘要:#include <stdio.h> //将10进制正整数转化为二进制 【5】 dec2bin(int m) { int bin[32],j; for(j=0;【1】;j++) { bin[j]=【2】; m=【3】; } for(;【4】;j--) printf("%d",bin[j-1]); }
阅读全文
摘要://功能:对=1,2,3,4,5,6,..,9,10 //求f(x)=x*x-5*x=sin(x)的最大值 并保留两位小数 #include <stdio.h> 【1】 【2】 f(x) x*x-5*x+sin(x) main( ) { int x;float max; max=【3】; for(x
阅读全文
摘要://下面程序的运行结果为_______________。 #include"stdio.h" main( ) { int a=3,b=5,c=8; if(a++<3 && c--!=0) b=b+1; printf("a=%d,b=%d,c=%d\n",a,b,c); } a=4,b=5,c=8
阅读全文
摘要://程序的功能是实现表达式z=( x>=y ? x : y),请将程序填写完整。 #include <stdio.h> main() { int x, y, z; printf("Please input x,y:"); scanf("%d%d",【1】); if 【2】 z=x; else 【3】
阅读全文
摘要:#include<stdio.h> //判断指定字符是数字还是小写字母或大写字母或其他字符 main() {【1】 ch; printf("请输入一个字符"); scanf("【1】",【1】); if(【1】) printf("%c是大写字母",ch); else if(【1】) printf("
阅读全文
摘要:#include<stdio.h> //输入一元二次方程的系数a,b,c,判断是否有解,有几个解 main() {【1】 a,b,c,dt; printf("请输入一个a,b,c的值,a不能为0\n"); scanf("%f %f %f",【2】); dt=【3】; if(【4】) printf("
阅读全文
摘要:#include<stdio.h> //水仙花数:三位数的每个数字的立方和等于这个数, 判断某数是不是水仙花数 main() {【1】; printf("请输入一个水仙花数"); scanf("%d",【2】); g=【3】; s=【4】; b=【5】; if(【6】==x) printf("%d是
阅读全文
摘要://任意输入三角形三边长,判断能否组成三角形,并求面积 【1】 【2】 main() {【3】 a,b,c,p,s; scanf("【4】",&a,&b,&c); if(【5】) {p=1/【6】*(a+b+c); s=sqrt(【7】); printf("三角形的面积是%f",s); } else
阅读全文
摘要:#include<stdio.h> main() {int x; printf("请输入一个整数"); scanf("%d",【1】); if(【1】) printf("%d能被3整除",x); else printf("%d不能被3整除",x); } #include<stdio.h> main(
阅读全文
摘要:#include<stdio.h> //判断指定年份是闰年还是平年 main() {int year; printf("请输入年数"); scanf("%d",【1】); if(【2】) printf("%d年是闰年",year); else if(year%【3】==0) printf("%d年是
阅读全文
摘要:/*输入日期,输出该天是该年的第几个。*/ #include<stdio.h> main() { int a,b,c,s=0; printf("请输入一个日期"); scanf("%d.%d.%d",&a,&b,&c); if(b==1) 【1】; if(b>1) s=s+31+c; if(b>2)
阅读全文
摘要:/*输入时间XX:XX:XX,输出一秒后对应的时间*/ #include<stdio.h> main() { int a,b,c; printf("请输入时间,格式为XX:XX:XX\n"); scanf("%d:%d:%d",&a,&b,&c); c++; if(【1】) { c=0; 【2】;
阅读全文
摘要:/*设圆半径r=1.5,圆柱高h=3,求圆周长,圆面积,圆球表面积,圆球体积,圆柱体积 用scanf输入数据,输出计算结果,输出时要求有文字说明,取小数后2位数字 球表面积公式 s=4*PI*r*r 球体积公式 v=4*pI*r*r/3 */ #include <stdio.h> 【7】 PI 3.
阅读全文
摘要:/*假设今天是星期日,编写一个程序,求123456天后是星期几*/ #include<stdio.h> int main() { int n,iday; printf("请输入天数:"); scanf("%d",【1】); 【2】; switch(【3】) { case 0:printf("%d天后
阅读全文
摘要:/*输入的一个小写字母,将字母循环后移5个位置后输出。如 ’a’ 将输出为 ‘f’ ,’w’ 输出为 ‘b’ 。 要求有输入提示"请输入一个小写字母:",若输入的不是小写字母,提示“输入非法”。*/ #include<stdio.h> main() { char ch; printf("请输入一个小
阅读全文
摘要:/*今有鸡兔同笼,上有三十五头,下有九十四足,问鸡兔各几何? */ /*在一个笼子里养着一些鸡和兔子,你想了解有多少只鸡和兔子。主人对你说: 鸡和兔子总头数是16和脚总数是40,你能自己计算有多少只鸡和兔子来吗?,如果不存在则输出无解*/ #include <stdio.h> main() { in
阅读全文
摘要:/* 从键盘输入两个时间点(24小时制),输出两个时间点之间的时间间隔,时间间隔用 “小时:分钟:秒 ”表示,如3点5分25秒表示为03:05:25.假设两个时间在同一天内,时间先后顺序与输入无关。 如:输入12:01:12 13:09:43 输出结果为 01:08:31 */ #include<s
阅读全文
摘要:/* 编写一个简单的计算器程序,输入格式为:data1 op data2是参加运算的两个数, op为运算符,它的取值只能是+、-、*/ #include<stdio.h> main() { int data1,data2; char op; scanf("%d%c%d",【1】); switch(【
阅读全文
摘要:/*假设今天是星期天,编写程序,求1、2、3、4、5、6天后 是星期几(用英文)? */ #include <stdio.h> main() { char 【1】; int xh; scanf("%d",【2】); printf("%d天后是%s",xh,【3】); } /*假设今天是星期天,编写程
阅读全文
摘要:/*注册输入名字,密码;名字只能是英文字母,密码只能是数字,已经有人注册名字U,用户名不能重复, 输入密码判断正确错误 ,再次输入密码判断。如两次密码一样,输出密码 */ #include<stdio.h> main() {char yhm,m1,m2; printf("输入用户名:"); scan
阅读全文
摘要:/* 输入三个整数,找出期中的中间数(这里的中间数指的是大小不是位置)*/ #include<stdio.h> main() { int a,b, c,max,min,mid; scanf("%d %d %d",&a,&b,&c); if(a>b) {max=a;【1】; } else {max=b
阅读全文
摘要:/*输入年号和月份,判断该年是否为闰年,并根据给出的月份判断是什么季节和该月有多少天? 闰年的条件是年号能被4整除但不能被100 整除或者能被400整除 3月-5月为春季,6月-8月为夏季 9月-11月为秋季 12月-2月为冬季*/ #include<stdio.h> main() { int y,
阅读全文
摘要:/*输出任意一个十进制数对应的八进制数和十六进制数*/ #include<stdio.h> main() { 【1】; printf("请输入一个整数:"); scanf("%d",【2】); printf("%d(10)<=>【3】(8)\n",i,i); printf("%d(10)<=>%x(
阅读全文
摘要:/*编程判断输入的整数的正负性和奇偶性。如果为正数,输出 z,如果为负数,输出 f, 如果为偶数,输出 o,如果为奇数,输出 j*/ #include<stdio.h> void main() { int a; 【1】; if(a>0) printf("z\n"); if(【2】) printf("
阅读全文
摘要:/*给出一个百分制的成绩要求输出成绩等级“A”、“B”“C” “D”“E”。90分以上的为“A”级80~89分的为“B”70~79 分的为“C”60~69分的为“D”60分以下的为“E”。*/ #include <stdio.h> main() { int grade; scanf(
阅读全文
摘要:/*从键盘输入一个4位正整数求其各位数字之积并输出。例如 若输入2523则输出应该是60。*/ #include <stdio.h> main() { int n,【1】,s,b,q,m; scanf("%d",【2】); q=n/1000; 【3】 s=n/10%10; g=n%10; m
阅读全文
摘要://已知三角形两边及夹角(角度制),求第三边及面积 #include<stdio.h> 【1】 【2】 main() {float a,b,c,alfa,s; 【3】 scanf("%f %f %f",&a,&b,&alfa); 【4】 c=sqrt(a*a+b*b-2*a*b*cos(alfa))
阅读全文
摘要:/*输入年份判断闰年*/ //闰年的判断依据是:若某年能被4整除,但不能被100整除,则这一年是闰年;若某年能被400整除,则这一年也是闰年 #include<stdio.h> main() { int yyear,【1】; printf(" 闰年查询 \n 请输入要查询的年份 :\n"); sca
阅读全文
摘要:#include <stdio.h> /*输入3个实数 a, b, c要求按从大到小的顺序输出三数.*/ main( ) { float a,b,c,t; scanf("%f,%f,%f",&a,&b,&c); if (a<b) {t=a; 【1】 ; b=t;} if( 【2】 ) {t=a; a
阅读全文
摘要:/*有一函数: y= x (x<10) 输入x的值,求y的值。 y=3x -2 (10≤x<50) y=4x+1 (50≤x<100) y=5x (x≥100)*/ 【6】 void main() { int x,y; 【1】 t; printf("input x=:"); scanf("【2】",
阅读全文