>[info]给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。
~~~C
#include <stdio.h>
int main() {
long w,q,b,s,g,x;
printf("input five num:\n");
scanf("%ld",&x);
w = x/10000;
q = x%10000/1000;
b = x%1000/100;
s = x%100/10;
g = x%10;
if(w!=0) printf("为5位数,逆序为:%ld %ld %ld %ld %ld\n", g,s,b,q,w);
else if(q!=0) printf("为4位数,逆序为:%ld %ld %ld %ld\n", g,s,b,q);
else if(b!=0) printf("为3位数,逆序为:%ld %ld %ld\n", g,s,b);
else if(s!=0) printf("为2位数,逆序为:%ld %ld\n", g,s);
else if(g!=0) printf("为1位数,逆序为:%ld\n", g);
return 0;
}
~~~
- C语言模块
- 基础入门
- 各种变量类型
- 条件编译
- 100例
- day1
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day2
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day3
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day4
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day5
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day6
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- day7
- 1.c
- 2.c
- 3.c
- 4.c
- 5.c
- 6.c
- 7.c
- 8.c
- 9.c
- 10.c
- linux基础知识
- 目录
- 系统设置
- ftp管理
- ftp-auth
- 进程
- ssh登录
- 权限属性
- 用户/用户组
- 安装命令
- 数据库操作
- 虚拟机vmvare-tools安装
- VI命令
- 上传下载
- error
- 虚拟机mac