c语言编程 假设m是一个三位数 则写出将m的个位 十位 百位反序而成的三位数的c语言表达式 如果是

c语言编程 假设m是一个三位数 则写出将m的个位 十位 百位反序而成的三位数的c语言表达式 如果是n位数怎么搞


 main()

int m = 123; 
int yushu = 0; 
where(m > 0)
{
 yushu  = m % 10;
 print("%d",yushu);
 m /= 10; 



如果是n为数字,你把123,换成你的n就行拉

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-10-25
#include <stdio.h>
int main()
{
int a[100]={},m,n;
printf("Please input the n:");
scanf("%d",&n);
printf("Please input the m:");
scanf("%d",&m);
int i,j;
for(i=0,j=1;i<n;i++,j*=10)
a[i]=(m/j)%10;
for(i=0;i<n;i++)
printf("%d",a[i]);
printf("\n");
return 0;
}本回答被网友采纳
第2个回答  2014-10-25
用sprintf格式化整数为char[]
相似回答