码迷,mamicode.com
首页 > 其他好文 > 详细

AC日记 - - - 19——分割整数

时间:2018-01-16 18:18:41      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:键盘   std   body   scanf   str   highlight   rip   log   ==   

Problem Description

从键盘输入一个长整数(不超过10位),从高位开始逐位分割并输出。

Input

正整数n,不含前导零。

Output

分割的整数序列,各整数之间用空格格开。
注意,最后一个数字后面没有空格!

Example Input

654321

Example Output

6 5 4 3 2 1

Hint

 

#include <stdio.h>
#include <stdlib.h>
int main()
{
    char num[10];
    int i;
    scanf("%s", &num);
    for(i=0; i<strlen(num); i++)
    {
        if(i==0)
        printf("%c", num[i]);
        else
        printf(" %c", num[i]);
    }

}

  

AC日记 - - - 19——分割整数

标签:键盘   std   body   scanf   str   highlight   rip   log   ==   

原文地址:https://www.cnblogs.com/Jie-Fei/p/8297121.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!