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.

CodePudding user response:

Fun
reference 5 floor 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.

Bosses, no one submit will display an error on the pta

CodePudding user response:

This problem should do her, there is no technical difficulties
 
# include & lt; stdio.h>
Int main (void)
{
Double c=0, r=0, s=0;
Lf lf scanf_s (" % % ", & amp; C., & amp; R);
S=c * r/100;
Printf (" the principal: % 2 lf \ n ", c);
Printf (" interest: % 2 lf \ n ", s);
Printf (" total: % 2 lf \ n ", c + s);
return 0;
}

CodePudding user response:

Floor is math. The inside of the h function, to include the header
Or replace with that code behind//s=(s) (int)/100.0
  • Related