這道題怎么辦????
已知自然數(shù)N≤1000000000 ,請(qǐng)編寫程序逆序輸出該自然數(shù)N的各位數(shù)字。
輸入
測試數(shù)據(jù)有多組,處理到輸入結(jié)束。
輸出
輸出自然數(shù)N各位數(shù)字的倒序,每個(gè)輸出占1行
樣例輸入
0
1
100
12345
11111111
123456789
1000000000
樣例輸出
0
1
001
54321
11111111
987654321
0000000001
2018-03-31
#include<stdio.h>
int main(void)
{
??? int num;
??? while(scanf("%d",&num)!=EOF){
??? if(num==0)
??????? printf("0");//加個(gè)判斷否則當(dāng)輸入為0時(shí)輸出為空
??? else{
??????? while(num){
??????????? printf("%d",num%10);
??????????? num=num/10;
??????? }
??? }
??? printf("\n");
??? }
??? return 0;
}