摘要:
思路:判断语句,小于0加符号,大于0直接输出 #include <stdio.h>#include <stdlib.h> int main(){ double a; while(scanf("%lf",&a)!=EOF) { if(a<0) a=-a; printf("%.2lf\n",a); } 阅读全文
摘要:
思路:用pow函数,定义pi #include <stdio.h>#include <stdlib.h>#include"math.h"#define PI 3.1415927 int main(){ double r,c; while(scanf("%lf",&r)!=EOF) { c=pow(r 阅读全文
摘要:
思路:用pow函数计算,并且分开两步,比较简洁 #include <stdio.h>#include <stdlib.h>#include<math.h> int main(){ double x,y,m,n,c; while(scanf("%lf %lf %lf %lf",&x,&y,&m,&n) 阅读全文