Home > Back-end > Bosses this problem is how to do
Bosses this problem is how to do
Time:10-16
CodePudding user response:
The direct write to go...
CodePudding user response:
For example Double c=0, r=0, s=0; Lf the scanf (" % % lf ", & amp; C., & amp; R); S=c * r; Printf (" the principal: % 2 lf \ n ", c); Printf (" interest: % 2 lf \ n ", s); Printf (" total: % 2 lf \ n ", c + s);
CodePudding user response:
Change, s=c * r/100
CodePudding user response:
This problem you will not do, this is never read the book
CodePudding user response:
There is a problem need to pay attention to In China's interest rate, points after truncation is not round, 123.456 as 123.45. The printf statements output is round 123.46 So can't directly output, but also make the result of transformation of Either with floor function or oneself do the truncation processing into
Double c=0, r=0, s=0; Lf the scanf (" % % lf ", & amp; C., & amp; R); S=c * r; s=floor (s)/100.0;//s=(s) (int)/100; Printf (" the principal: % 2 lf \ n ", c); Printf (" interest: % 2 lf \ n ", s); Printf (" total: % 2 lf \ n ", c + s);
However, this is to test, maybe shouldn't have done this.