再帰関数を利用した出力問題
ex) Recursive(5);
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
[answer]
void Recursive(int n)
{
if (n < 1) return;
for(int i = 0; i < n; i++) {
printf("%d ", n - i);
}
printf("\n");
Recursive(--n);
}
Go to list of users who liked
More than 5 years have passed since last update.
再帰関数を利用した出力問題
ex) Recursive(5);
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
[answer]
void Recursive(int n)
{
if (n < 1) return;
for(int i = 0; i < n; i++) {
printf("%d ", n - i);
}
printf("\n");
Recursive(--n);
}
Register as a new user and use Qiita more conveniently
Go to list of users who liked