package test;
public class Test01 {
	public static void fun(double dTestNo, int iBase) {
		int[] iT = new int[8];
		int iNo;
		System.out.print("十进制正小数" + dTestNo + " 转换成 " + iBase +" 进制数为:0.");
		for(iNo=0;iNo<iT.length;iNo++) {
			dTestNo = dTestNo * iBase;
			iT[iNo] = (int)dTestNo;
			
			if(dTestNo>1.0)
				dTestNo = dTestNo - iT[iNo];			
		}
		for(iNo=0; iNo<iT.length; iNo++) {
			System.out.print(iT[iNo]);
		}
		System.out.println();
	}
	public static void main(String[] args) {
		double dTestNo= 0.795;
		int iBase;
		for(iBase=2;iBase<=9;iBase++)
			fun(dTestNo,iBase);
	}
}

最近下载更多
jcx123  LV6 2018年12月24日
wadwendang  LV1 2018年12月24日
chenmg  LV8 2018年12月22日
zhangyan1232  LV3 2018年12月22日
zlz147258  LV1 2018年12月22日
cmt460  LV12 2018年12月21日
dijiuwei  LV1 2018年12月20日
tangyuliang  LV1 2018年12月20日
204570995  LV1 2018年12月20日
Matrixzj  LV7 2018年12月19日
最近浏览更多
jcx123  LV6 2018年12月24日
ykqykq  LV2 2018年12月24日
heifenglei  LV7 2018年12月24日
fsheng122  LV7 2018年12月24日
a5889763a  LV4 2018年12月24日
luyun1993  LV4 2018年12月24日
silaimudexiaoxiongdi  LV1 2018年12月24日
梁中山  LV2 2018年12月24日
故事_sun  LV26 2018年12月24日
wadwendang  LV1 2018年12月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友