3804 - 第二章:实数运算《练习3:实数除法》
输入两个实数a和b,输出它们相除的结果。
Input
输入中只有一行,包括两个实数。两个实数间用一个空格隔开。
Output
只包括一个数,即输入的两实数相除的结果(保留两位小数,第三位小数四舍五入)。
Examples
Input
10 3
Output
3.33
Solution C
#include <stdio.h> int main(void) { double a, b = 0, c; scanf("%lf", &a); while(b == 0) scanf("%lf", &b); c = a / b; printf("%.2lf\n", c); return 0; }
Solution C++
#include<cstdio> using namespace std; int main() { double a,b,s; scanf("%lf%lf",&a,&b); s=a/b; printf("%.2lf\n",s); return 0; }