Question 99: dividing an integer

Source: Internet
Author: User

[Plain] Description
 
Input a positive and long integer (no more than 10 digits) from the keyboard, split and output from the high position one by one.
 
Input
 
Positive integer n, excluding leading zero.
 
Output
 
Split an integer sequence. Each integer is separated by an empty space.
Note that there is no space behind the last number!
 
Sample Input
 
 
654321
 
Sample Output
 
 
6 5 4 3 2 1

Description

Input a positive and long integer (no more than 10 digits) from the keyboard, split and output from the high position one by one.

Input

Positive integer n, excluding leading zero.

Output

Split an integer sequence. Each integer is separated by an empty space.
Note that there is no space behind the last number!

Sample Input


654321

Sample Output


6 5 4 3 2 1

[Plain] # include <stdio. h>
 
Int main ()
{
Int I;
Int num;
Int length = 0;
Int array [10];
 
Scanf ("% d", & num );
 
While (num)
{
Array [length ++] = num % 10;
Num/= 10;
}
For (I = length-1; I> = 0; I --)
{
Printf ("% d", array [I]);
If (I> 0)
{
Printf ("");
}
}
 
Return 0;
}

# Include <stdio. h>

Int main ()
{
Int I;
Int num;
Int length = 0;
Int array [10];

Scanf ("% d", & num );

While (num)
{
Array [length ++] = num % 10;
Num/= 10;
}
For (I = length-1; I> = 0; I --)
{
Printf ("% d", array [I]);
If (I> 0)
{
Printf ("");
}
}

Return 0;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.