Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:48
Show Gist options
  • Save pinglunliao/4b88a358c6b749991be6 to your computer and use it in GitHub Desktop.
Save pinglunliao/4b88a358c6b749991be6 to your computer and use it in GitHub Desktop.
a248: 新手訓練 ~ 陣列應用 FYI: https://yunlinsong.blogspot.com/2015/11/blog-post_7.html
#include <cstdio>
int main() {
int a, b, n;
while(scanf("%d%d%d", &a, &b, &n) != EOF)
{
printf("%d.", a / b), a = a % b;
for(int i = 0; i < n; i++)
{
a = a * 10,
printf("%d", a / b),
a = a % b;
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment