首页 > 其他 > 详细

进制转换为伪代码

时间:2020-11-07 12:34:31      阅读:66      评论:0      收藏:0      [点我收藏+]
a=int(input(‘enter the new base‘))
b=int(input(‘enter the number to be converted‘))
e=‘0‘
if a==2:
    if b==2:
        print(10)
    if b==1:
        print(1)
    if b==0:
        print(0)
    while b>2:
        c=b%2
        e=str(c)+e
        b=int(b%2)
        if b==3:
            e=‘1‘+‘1‘+e
            print(e)
        if b==2:
            e=‘1‘+‘0‘+e
            print(e)

进制转换为伪代码

原文:https://www.cnblogs.com/cqszxy2020/p/13940404.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!