So I just received my paper. its said if the input number is 0.001001001
(repeated) it's gonna print 0.001...
, if it's 0.015015015
, then 0.015...
as a print, if the number is 998
its should be 0.998...
my idea is to divide it into something like 2 pieces but im still cant figure its out. thanks
scanf("%f",&num1);
scanf("%f",&num2);
scanf("%f",&num3);
num1 = floor(1000*(num1/999))/1000;
num2 = floor(1000*(num2/999))/1000;
num3 = floor(1000*(num3/999))/1000;
printf("%.3f...
",num1);
printf("%.3f...
",num2);
printf("%.3f...
",num3);
input = 3 integers that divide to 999, the value is below 999
output = the result, if the result repeated (0.001001001) then its going to print out 0.001...
sample :
input = output
3 = 0.003...
10 = 0.010...
998 = 0.998...
Note: I tried it with the floor so i guess there's something error about my logic
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…