首页 > 其他分享 >实现进制转化伪代码

实现进制转化伪代码

时间:2022-10-08 21:59:13浏览次数:52  
标签:Write Set 进制 代码 转化 newBase answer quotient decimalNumber

伪代码

Write "Enter the new base"
Read newBase
Write "Enter the number to be converted"
Read decimalNumber
Set quotient to 1
WHILE (quotient is not zero)
	Set quotient to decimalNumber DIV newBase
	Set remainder to decimalNumber REM newBase
	Make the remainder the next digit to the left in the answer
	Set decimalNumber to quotient
Write "The answer is "
Write answer

代码

运行结果

十进制转二进制

十进制转八进制

十进制转十六进制

标签:Write,Set,进制,代码,转化,newBase,answer,quotient,decimalNumber
From: https://www.cnblogs.com/liu-221304-yi-tong/p/16751102.html

相关文章