zoukankan      html  css  js  c++  java
  • 实现进制转换伪代码

    伪代码的算法程序
    newBase=int(input('请输入您想转换成的值的进制: '))
    decimalNumber=int(input('请输入您想转换的十进制值: '))
    quotient=1
    m={10:'A',11:'B',12:'C',13:'D',14:'E',15:'F'}
    list_=[]
    while quotient != 0:
    quotient=decimalNumber//newBase
    remainder=decimalNumber%newBase
    if remainder in m:
    remainder=m[remainder]
    list_.append(remainder)
    decimalNumber=quotient
    list_.reverse()
    print(' ')
    print('结果是:')
    for i in list_:
    print(i,end='')

    运行结果
    二进制:

    八进制:

    十六进制:

  • 相关阅读:
    C
    B
    A
    poj1222
    请求转发和重定向
    中文乱码
    Servlet 第一天
    Oracle 锁
    Oracle 包的学习
    初学Linux
  • 原文地址:https://www.cnblogs.com/wxl2761407387/p/13943204.html
Copyright © 2011-2022 走看看