如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
疯狂的路哥,安全工程之绝版//写这些程序哥容易么//5.5有一个x,y值输出函数写一段程序,输入//作者:付路路#include"stdio.h"voidmain(){intx,y;printf("输入x:\n");scanf("%d",&x);if(x<1){y=x;printf("x=%3d,y=x=%d\n",x,y);}elseif(x<10){y=2*x-1;printf("x=%3d,y=2*x-1=%d\n",x,y);}else{y=3*x-11;printf("x=%3d,y=3x-1=%d\n",x,y);}}/*5.7给5位定一①的正求②分它是个不别打整数几位多于印出,要数;每一求:位数字;③按逆序321,123。*/应输打印出出各位数字。例如原数为//你路哥的#include<stdio.h>main(){longintnum;intindiv,ten,hundred,thousand,ten_thousand,place;/*分别代表个位、十位、百位、千位、万*/printf("请0~99999输入):\n");一个整数(scanf("%ld",&num);if(num>9999)place=5;elseif(num>999)place=4;elseif(num>99)place=3;elseif(num>9)place=2;elseplace=1;printf("place=%d\n",place);ten_thousand=num/10000;疯狂的路哥,安全工程之绝版thousand=num/1000%10;hundred=num/100%10;ten=num%100/10;indiv=num%10;switch(place){case5:printf("%d,%d,%d,%d,%d",ten_thousand,thousand,hundred,ten,indiv);printf("\n反序数字为;");printf("%d%d%d%d%d\n",indiv,ten,hundred,thousand,ten_thousand);break;case4:printf("%d,%d,%d,%d",thousand,hundred,ten,indiv);printf("\n反序数字为:");printf("%d%d%d%d\n",indiv,ten,hundred,thousand);break;case3:printf("%d,%d,%d",hundred,ten,indiv);printf("\n反序数字为:");printf("%d%d%d\n",indiv,ten,hundred);break;case2:printf("%d,%d",ten,indiv);printf("\n反序数字为:");printf("%d%d\n",indiv,ten);break;case1:printf("%d",indiv);printf("\n反序数字为:");printf("%d\n",indiv);break;}}/*6.6打印出所有"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该本身。例如:153是一个水仙花数,因为153=1^3+5^3+3^3。*///kao没意思#include"stdio.h"#include"math.h"voidmain(){intx=100,a,b,c;while(x>=100&&x<1000){a=0.01*x;b=10*(0.01*x-a);c=x-100*a-10*b;if(x==(pow(a,3)+pow(b,3)+pow(c,3)))printf("%5d\n",x);x++;疯狂的路哥,安全工程之绝版}}//输出结果是153370371407/*6.10猴子吃桃问题。猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个。第二天早上又将剩下的桃子吃掉一半,又多吃一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘多少桃子。*/#include"stdio.h"voidmain(){inti=1,sum=0;for(;i<=10;sum=2*sum+1,i++);printf("sum=%d\n",sum);}/*7.6打印出以下杨辉三角形(要求打印出10行)。11112113311464115101051*/#include"stdio.h"main