发布时间:2014-12-19 14:13:42
//2:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时// 共有5个数相加),几个数相加有键盘控制#include<stdio.h>int main(){int a, sum ,num;scanf("%d%d",&a, &num);switch (a){case 1:{sum=a;printf("%d\n",sum);break;}case 2:{sum=a+(a*10+a);printf("%d\n",.........【阅读全文】
发布时间:2014-12-15 11:56:52
#include<stdio.h>int result_num(double a ,double b,double c){if((b*b-4*a*c)/2*a>0){return 2;}else if((b*b-4*a*c)/2*a==0){return 1;}else {return 0;}}int main(){double a,b,c;scanf("%f%f%f");printf("方程的根%d个实数根\n",result_num(a,b,c));}.........【阅读全文】
发布时间:2014-12-15 11:48:13
#include<stdio.h>double calculator(double a, double b, char operator){if (operator=='+'){return a+b;}else if (operator=='-'){return a-b;}else if (operator=='*'){return a*b;}else if (operator=='/'){if(b==0){printf(" 输入的有误,除数不能为零\n");}else{return a/b;}}else&.........【阅读全文】