SDUT-1175 C语言实验——分割整数

来源:互联网 发布:js this指向 编辑:程序博客网 时间:2024/05/22 10:44

C语言实验——分割整数

Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic Discuss

Problem Description

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

Input

正整数n,不含前导零。

Output

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

Example Input

654321

Example Output

6 5 4 3 2 1

Code

#include <stdio.h>#include <string.h>int main(){    char a[10];    int n,i;    gets(a);    n=strlen(a);    printf("%c",a[0]);    for(i=1;i<n;i++)        printf(" %c",a[i]);    return 0;}