输入两个正整数并存入A,B中,并由A,B两个数生成新的数C,以十六进制输出A,B,C的值。

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结

就是用输入输出(入门)自学
原题目
输入两个正整数并存入A, B中,并由A, B两个数生成新的数C (将A的低字节
作为C的高字节,将B的高字节作为C的低字节),以十六进制输出A,B, C的值。

整数如果用int类型的话,代码如下:

#include <stdio.h>
int main()
{
    int a,b,c;
    int m,n;
    scanf("%d%d",&a,&b);
    m = a & 0x0000ffff;  //int类型占4个字节
    m << 16;
    n = b & 0xffff0000;
    n>>16;
    c =  m+n ;
    printf("A=%x,B=%x,C=%x",a,b,c);
    return 0;
}

如果用short类型,diam如下:

#include <stdio.h>
int main()
{
    short a,b,c;
    short m,n;
    scanf("%hd%hd",&a,&b);
    m = a & 0x00ff; //short占2个字节
    m << 8;
    n = b & 0xff00;
    n>>8;
    c =  m+n ;
    printf("A=%x,B=%x,C=%x",a,b,c);
    return 0;
}