输入一个正整数x,若x满足0<x<32767,则输出X是几位数并输出x个位上的数字 编写程序
推荐回答
1234567891011121314151617#include<stdio.h>int f(int x){ int count = 0; while(x){ count++; x/=10; } return count;}int main(){ int x; scanf("%d",&x); if(x>0 && x<32767){ printf("位数 :%d 位数:%d\n",f(x),x%10); } return 0;}