Home > Back-end >  A small white want to OJ
A small white want to OJ

Time:10-28

Exactly how can I unwrapped my input digital output, autistic!
Detailed guidance for bosses, save the children!
Problem description:
Known to be a positive integer n, n is the range of 1-999999999, your task is to put the integer factorization to a single number, and then from left to right, in turn, printing out each number, such as integer "12345", "1, 2, 3, 4, 5",

The input and output requirements:
Input consists of a positive integer, that is, to break up the integer n, 1 & lt;=n<=999999999, the output of integer resolution as a result, there is a space between the adjacent two Numbers, after the last digit is a newline character, such as separation results of the 12345 "1, 2, 3, 4, 5"

Program running effect:
Sample 1:
Input: 12345
Output: 1, 2, 3, 4, 5
Sample 2:
Input: 1
Output: 1

CodePudding user response:

 # include & lt; Stdio. H> 
# include & lt; String. H>

Int main ()
{
Char num [10].
Memset (num, 1, sizeof (char) * 10);
The scanf (" % s ", num);
for (int i=0; i <10; I++)
{
If (num [I]!=1)
Printf (" % c ", num [I]);
}
printf("\n");
return 0;
}


For your reference

CodePudding user response:

The
reference 1/f, 5250 response:
 # include & lt; Stdio. H> 
# include & lt; String. H>

Int main ()
{
Char num [10].
Memset (num, 1, sizeof (char) * 10);
The scanf (" % s ", num);
for (int i=0; i <10; I++)
{
If (num [I]!=1)
Printf (" % c ", num [I]);
}
printf("\n");
return 0;
}


For your reference


This program, you can do it:
 for (int I=0; i 

CodePudding user response:

 # include & lt; Stdio. H> 
# include & lt; Stdlib. H>
# include & lt; String. H>



Void print_digit (unsigned long num);

Int main (void)
{
Unsigned long num.

The scanf (" % lu ", & amp; Num);


Print_digit (num);
Putchar (10);

return 0;
}

Void print_digit (unsigned long num)
{
If (num==0)
return;

Print_digit (num/10);
Printf (" % lu ", num % 10);
}


For your reference ~

As above, can consider to use recursive functions

CodePudding user response:

reference 2 building self-confidence boy reply:
Quote: reference 1/f, 5250 response:
 # include & lt; Stdio. H> 
# include & lt; String. H>

Int main ()
{
Char num [10].
Memset (num, 1, sizeof (char) * 10);
The scanf (" % s ", num);
for (int i=0; i <10; I++)
{
If (num [I]!=1)
Printf (" % c ", num [I]);
}
printf("\n");
return 0;
}


For your reference


This program, you can do it:
 for (int I=0; i  


thank you

CodePudding user response:

Thank you for your attention!
  • Related