用C语言编程输入任意一个整数使其倒序输出
- 提问者网友:你给我的爱
- 2021-06-01 21:24
- 五星知识达人网友:往事隔山水
- 2021-06-01 22:47
#include<string.h>
void main()
{
char str[100];
int n;
printf("input a number:");
gets(str);
n=strlen(str);
for(;n>=0;n--)printf("%c",str[n]);
getchar();
}
- 1楼网友:舊物识亽
- 2021-06-02 03:26
*********您好!Yadie.23很高兴能为你解答。********* +++++++++++++++++++++++++++++++++++++++++++++++++
#include<stdio.h> #include<conio.h> void main() {
int num; scanf("%d",&num); while(num>0) { printf("%d",num%10); num=num/10; } printf("\n"); getch(); }
+++++++++++++++++++++++++++++++++++++++++++++++++ You can have a try,maybe my answer useful to you. 如满意,Yadie.23十分感谢您的采纳。*^-^*
- 2楼网友:孤独入客枕
- 2021-06-02 02:04
#include<stdio.h> void main() {int num,a,b,c; scanf("%d",&num); while(num>0) { c=num%100; printf("%d",c); num=num/100; } printf("\n"); }
- 3楼网友:一叶十三刺
- 2021-06-02 00:41
unsigned char ReverseBitsInChar00(unsigned char Num)
{
unsigned char ret = 0;
int i;
for(i=0;i<8;i++)
{
ret <<= 1;
ret |= Num & 1;
Num >>= 1;
}
return ret;
}
8位的倒序操作。
如果要是做FFT的倒序,还有别的办法。
- 4楼网友:山君与见山
- 2021-06-02 00:23
#include<stdio.h> void main() {int num,a,b,c; scanf("%d",&num); while(num>0) { c=num%10; printf("%d",c); num=num/10; } printf("\n"); }
//它只对10位以内的数有效
- 5楼网友:几近狂妄
- 2021-06-02 00:04
strrev 我有别的方法用上面的字符串函数将字符串倒置,然后在转换为整形数