#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
/*
倒序输出五位数
*/
long num,count=0,num1=0,num2=0;
scanf("%ld",&num);
num1=num;
//计算接收的数字有几位
while ((num1/=10)!=0) {
count++;
}
//倒序逐个输出
for (int i=0; i<count+1; i++) {
num2=num%10;
printf("%ld",num2);
num/=10;
}
printf("\n");
}
return 0;
} |
|
|