Seeking a one decimal

[Description] title
after abab fraction into a decimal, the nn-digit number after the decimal point is how much?

[Input]
three positive integers a, b, na, b, n, separated by a single space between two adjacent numbers. 0 <a <b <100,1≤n≤100000 < a <b <100,1≤n≤10000.

[Output]
a number.

Sample Input []
121
[Output] Sample
5
[Reference Program]

#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a,b,n,t;
cin>>a>>b>>n;
for(int i=1;i<=n;++i)
{
a*=10;
t=a/b;
a%=b;
}
cout<<t<<endl;
return 0;
}
Published 100 original articles · won praise 0 · Views 3220

Guess you like

Origin blog.csdn.net/fjkgh/article/details/104231573