在C中将int转换为seperated int [英] Converting an int into seperated int in C

查看:130
本文介绍了在C中将int转换为seperated int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想将一个int数字(例如5267或1000000)转换为分离的整数。

类似于数字5267它是5 2 6 7,所以我可以用putchar()打印它们。我知道,但我必须在我的代码中只使用putchat和getchar。 (没有printf或scanf)。

我对它有一些想法,但我唯一想到的是这个代码向后打印数字:PLS helpPLS :::::

I just want to convert an int number such as 5267 or 1000000 into seperated integeres.
like for number 5267 it be 5 2 6 7 , so i can print them with putchar(). I know, but i have to use only putchat and getchar in my code. ( no printf or scanf).
I had some thoughts about it but the only thing that i came up is this code which prints the number backward: PLS helpPLS:::::

展开 | 选择 | Wrap | 行号

推荐答案

你可以先反转这个号码,然后调用你的函数打印这些值。



raghuram
can you first reverse the number and then call your function to print the values.


raghuram


展开 | 选择 | Wrap | 行号


这是C,对吧?


只需使用itoa()。
This is C, right?

Just use itoa().


这篇关于在C中将int转换为seperated int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆