數字轉成字符

#include "Stdio.h"
#include "Conio.h"

main()
{
    int i,k=0;
    int num=12345;
    char c,s[10];
    while (num>0)
    {
        c=(num%10)+'0';
        s[k++]=c;
        num/=10;
    }
    s[k]='/0';
    for(i=0;i<strlen(s);i++)
        printf("output number:%c/n",s[i]);
getch();
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章