C language _ recursion _ function to find the number on each integer

Description

Write a function, input a four-digit number, and ask to output these four numeric characters, but there is a space between every two numbers. If you enter 1990, it should output "1 9 9 0".

Input

A four-digit number

Output

Increase space output

Sample Input

1990

Sample Output

1 9 9 0 

The specific code is as follows: The
key is to understand the specific operation process of recursion clearly

#include<stdio.h>
void change(int a); 
int main()
{
    
    
 int a;
 scanf("%d",&a);
 change(a);
 return 0;
}
void change(int a)
{
    
    
 if(a>9)  //注意此处递归终止的条件 
 change(a/10);
 printf("%d ",a%10);
}

Guess you like

Origin blog.csdn.net/qq_51366851/article/details/112986284