用循环语句解决问题,判断数的位数

从键盘上输入一个整数,判断是几位数,并逆序输出
踏月光
浏览 980回答 1
1回答

望远

#include<stdio.h> void main() { int i,n; do{ printf("请输入一个正整数:"); scanf("%d",&n); if(n<=0) { printf("数据错误,请重新输入!!\n"); } }while(n<=0); printf("逆序输出:"); for(i=0;n>0;i++) { printf("  %d",n%10); n=n/10; } printf("\n这是一个%d位数\n",i); }

慕瓜9220888

OMSBXYVVWESNCVFCTJINHTTZQTULZIRGTAHBRPENPMFFQQHTFYVLOHGRJLKNYRHSKLKCFOOHTOXQSRBSMDBENFWZGHIWMLBIYPZZOTCLSJWGCQFVDBJAUOCVGIPWQAVLKTCJMWDTIHQIPGTDOWSATDKEYSKSBKBBMWYMPYQHUBDCXGZOFLCLAILETEBBCDSRQTDACMBQYRKBHQQCPLONKHRYOAPOKRYIGZNGFOVWWKGLKDMJGNEPNWHQNNOSGOBTGWXAULRHZPFGGXRZWMLTHEYCEMVEBYPDPDMFEOLBCGPRGZDTFGITMEUUBBZFTWYRYVIIMKNSRYZPQLQAPEBPZJNFENWTVPQGOUTCJJAXJOXFVVSJJQILDWDKULXLENMDTARQHCOWJSVVPCLNVFRUEFWPKHRHKDBIOZOBEEQPHRWPYIYBFAMHWWPIKUIKJUKHNQBBKNCANNOUEJSBOVCCSTWVUBVCDSGTIROESVZDCLOEVCCKMYHNKHOOWKXDKHYEYBACVYELMEMUDGFMKRHYMCLUKXDTOCFEFSTTAZHAJIHOEVZYQZPERBSFDWYANTKLPKTLUBYFPUPYUNUBBVFXPIHISJJMEXZIWAXOEVIAAGNHYLUXGFUCZAHZPFXOFQANVMLYVVWTMEQKZZAUUWXATVIMDJCAMFYLUABNLZRKULLFVRJCIOPWQNBUDLSMEYCHGOYQNOOQYQPCJGWEBQILARSWXBCLXMDKRQFYXWTXHRSWWFPXYFVMXPZFNYVPZALONFWJAHRZBAZGUEBESENEBIZTWAZIYVBCCDYXWFWWNXZHQFLBOPFCKNMPVMTTRYHXGTQQAHFIA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