为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

C
踏月光 2016-11-03 19:58:24
从键盘上输入一个整数,判断是几位数,并逆序输出
查看完整描述

1 回答

已采纳
?
望远

TA贡献1017条经验 获得超1032个赞

#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);

	

}

//img1.sycdn.imooc.com//581b50ea0001980402800090.jpg

查看完整回答
1 反对 回复 2016-11-03
点击展开后面2
?
慕瓜9220888

TA贡献868条经验 获得超0个赞

OMSBXYVVW

ESNCVFCTJ

INHTTZQTU

LZIRGTAHB

RPENPMFFQ

QHTFYVLOH

GRJLKNYRH

SKLKCFOOH

TOXQSRBSM

DBENFWZGH

IWMLBIYPZ

ZOTCLSJWG

CQFVDBJAU

OCVGIPWQA

VLKTCJMWD

TIHQIPGTD

OWSATDKEY

SKSBKBBMW

YMPYQHUBD

CXGZOFLCL

AILETEBBC

DSRQTDACM

BQYRKBHQQ

CPLONKHRY

OAPOKRYIG

ZNGFOVWWK

GLKDMJGNE

PNWHQNNOS

GOBTGWXAU

LRHZPFGGX

RZWMLTHEY

CEMVEBYPD

PDMFEOLBC

GPRGZDTFG

ITMEUUBBZ

FTWYRYVII

MKNSRYZPQ

LQAPEBPZJ

NFENWTVPQ

GOUTCJJAX

JOXFVVSJJ

QILDWDKUL

XLENMDTAR

QHCOWJSVV

PCLNVFRUE

FWPKHRHKD

BIOZOBEEQ

PHRWPYIYB

FAMHWWPIK

UIKJUKHNQ

BBKNCANNO

UEJSBOVCC

STWVUBVCD

SGTIROESV

ZDCLOEVCC

KMYHNKHOO

WKXDKHYEY

BACVYELME

MUDGFMKRH

YMCLUKXDT

OCFEFSTTA

ZHAJIHOEV

ZYQZPERBS

FDWYANTKL

PKTLUBYFP

UPYUNUBBV

FXPIHISJJ

MEXZIWAXO

EVIAAGNHY

LUXGFUCZA

HZPFXOFQA

NVMLYVVWT

MEQKZZAUU

WXATVIMDJ

CAMFYLUAB

NLZRKULLF

VRJCIOPWQ

NBUDLSMEY

CHGOYQNOO

QYQPCJGWE

BQILARSWX

BCLXMDKRQ

FYXWTXHRS

WWFPXYFVM

XPZFNYVPZ

ALONFWJAH

RZBAZGUEB

ESENEBIZT

WAZIYVBCC

DYXWFWWNX

ZHQFLBOPF

CKNMPVMTT

RYHXGTQQA

HFIAZKRHR

LZIRNUUBT

MQJCUDARX

WPSWCKIQH

BSZMGKQOE

CKBVSAQYZ

NMDJCQXYP

TGTMVSMPP

XHLJMIPXH

EYRRGHOVF

MOXASMQPQ

CBTMBSPMT

CXAZSPPGW

IAJLULYIJ

JRAJMCJAA

CNPVNUBLM

SUDNAABBL

LJBBLIZDN

FWFRCMWXX

YMPODPNAK

ECVDWDEKW

YWFVUABYI

NLAJPWCDD

OCLRKQHBL

CEPBAHBOZ

LTIRAHZQK

KFONMGQQM

LJFYDRLBV

QYALEYSIT

GOXZFISTA

YUDJYFLIJ

EIRKDDKRB

QILATZGDK

LNMBUKRBV

APOGJQNDU

XAZIQBYYZ

VAJZEVMUV

WNDMULCSW

MYARAXHCW

QBHGXYVVM

KXCLOEVMG

IQGMRVLWM

TSHBUVSPZ

IGVEQROAH

JHAHQABHB

EWIHKUHOO

BDVLEELLM

BQKTCCJNX

UGXQYFCDA

AIKNFEBYZ

PDDVYBYXO

WLRTZWCDA

MDQPOVJQG

HLBCKHFFZ

ESLUMDUAT

VDMOXULII

LXWPOUVVW

XVOQTQWNH

MEDCGNOIS

AFHGJWJQH

RWVNNKAHY

OXKAZJTUO

KCYRNXOVL

QEAAJDDVQ

LMVUKAXOE

BTIBTAMTD

PHIHAGNUV

VHTCVBICD

RZRXQNARR

NEHQSZGNN

HGMEHEUVH

LLEJIJTTD

FDMLUKZTA

UIBAGDGPP

VDJBKSJKO

EJBETQUKG

XMLNTCTTD

ODFIRYFFP

VNSBEROVP

CAGZWNXWW

WPCODUBOI

JOYYHOFMM

YCSRTGRRB

VDCLKUBBL

LTSNDKAKV

JONCVMCDD

DEMOOEVPM

查看完整回答
反对 回复 2021-10-19
  • 1 回答
  • 1 关注
  • 979 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信