码迷,mamicode.com
首页 > 编程语言 > 详细

c语言实现,将整数n这个数字转换为对应的字符串

时间:2015-10-21 00:25:12      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:c语言   将整数n这个数字转换为对应的字符串   

#include<stdio.h>
int main ()
{
     int i=0;
     char arr[10]={0};
     int n=0;
     int j=0;
     scanf("%d",&n);
     if(n<0)
     {
          n=-n;
     }
     while(n)
     {
          arr[j]=n%10;
          n/=10;
          j++;
     }
     for(i=j-1; i>=0; i--)
     {
          printf("%d ",arr[i]);
     }
     return 0;
}


c语言实现,将整数n这个数字转换为对应的字符串

标签:c语言   将整数n这个数字转换为对应的字符串   

原文地址:http://green906.blog.51cto.com/10697569/1704703

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