1114: reverse
time limit: 1 Sec memory limit: 128 MB
Submit: 15185 Resolution: 9322
[Status] [discussion boards] [submitted] [proposition al: ADMIN]
Title Description
Input n (1 <= n <= 10) and n integers, the n integers reverse order output.
Input
Input n (1 <= n <= 10), and enter the n integers.
Output
reverse output of these n integers, each representing an integer of 4, right justified.
Sample input the Copy
. 6
. 4. 5. 6. 1 2. 3
sample output the Copy
. 3 2. 6. 5. 4. 1
#include<stdio.h>
void inverse(int n)
{
int num;
if(n>1)
{
scanf("%d",&num);
inverse(n-1);
printf("%4d ",num);
}
if(n==1)
{
scanf("%d",&num);
printf("%4d ",num);
}
}
int main()
{
void inverse(int n);
int n;
scanf("%d",&n);
inverse(n);
printf("\n");
return 0;
}