摘要: 1 /*编程求解一元二次方程的解 ax^2+bx+c=0*/ 2 #include 3 #include 4 main() 5 { 6 float a,b,c,disc,x1,x2; 7 printf("Input a,b,c:\n"); 8 scanf("%f%f%f",&a,&b,&c); 9 disc=b*b-4*a*c;10 if (disc<0)11 {12 printf("方程式没有实根\n");13 }14 else 15 {16 x1=(-b+sqrt(disc))/(2*... 阅读全文
posted @ 2013-10-23 23:48 ASMLearner 阅读(859) 评论(0) 推荐(0) 编辑
摘要: 1 /*编程求圆周长、圆面积、圆球体积、设圆半径r=1.5。要求:用scanf输入数据,输出计算结果,输出时要求有文字说明,取小数后2位*/ 2 /*圆球体积公式 V=(4*π*r3)/3 */ 3 #include 4 main() 5 { 6 float r,Pi=3.14; 7 printf("Please input r:\n"); 8 scanf("%f",&r); 9 printf("The Circumference is %.2f\n",2*Pi*r);10 printf("The Area of c 阅读全文
posted @ 2013-10-23 15:21 ASMLearner 阅读(8812) 评论(0) 推荐(0) 编辑
摘要: 1 /*请编程将"China"译成密码,用原字母后的第四位替换原字母,用putchar 和printf函数输出*/ 2 #include 3 main() 4 { 5 char ch1='C',ch2='h',ch3='i',ch4='n',ch5='a'; 6 printf("the source Character is: %c%c%c%c%c\n",ch1,ch2,ch3,ch4,ch5); 7 printf("the Be encrypted charact 阅读全文
posted @ 2013-10-23 14:48 ASMLearner 阅读(2838) 评论(0) 推荐(0) 编辑
摘要: 1 /* 输入a,b,c三个整数,将a,b,c 由大到小输出*/ 2 #include 3 main() 4 { 5 int a,b,c,k; 6 printf("please input three integer number : \n"); 7 scanf("%d%d%d",&a,&b,&c); 8 if (a<b) 9 {10 k=a;11 a=b;12 b=k;13 }14 if (a<c)15 {16 k=a;17 a=c;18 ... 阅读全文
posted @ 2013-10-23 14:29 ASMLearner 阅读(363) 评论(0) 推荐(0) 编辑
摘要: /*判断一个数能否同时被3和5整除*/#includemain(){int Anmber;printf("Please input an integer number: \n");scanf("%d",&Anmber);if ((Anmber%3==0)&&(Anmber%5==0)){printf("The number you entered [%d] can be divisibility by 3 and 5!\n",Anmber);}else {printf("The number you 阅读全文
posted @ 2013-10-23 13:18 ASMLearner 阅读(701) 评论(0) 推荐(0) 编辑