如何将输入得四位十进制数,转成BCD码,存在地址为3000H为起始地址的内存中。 (用c语言)?

将输入得四位十进制数,转成BCD码,存在地址为3000H为起始地址的内存中。
(用c语言)

#include<stdio.h>
void main() { int x,xx; unsigned int y,k,*p; unsigned char *q;
scanf("%d",&x); xx=x%10000; q=(unsigned char *)0x3003;

while ( xx ) { *q=xx%10; xx/=10; q--; } //存放bcd码大端模式
}

假定输入1234,则从3000H开始的值为:01H,02H,03H,04H
温馨提示:答案为网友推荐,仅供参考
第1个回答  2020-03-19
用 C 语言?
有点不像啊。
相似回答