其他分享
首页 > 其他分享> > c语言 7-2

c语言 7-2

作者:互联网

 

1、

#include <stdio.h>
#include <math.h>

int main(void)
{
    unsigned x;
    int n;
    puts("please input an unsigned number and an integer.");
    printf("x = "); scanf("%u", &x);
    printf("n = "); scanf("%d", &n);
    
    (x << n) == x * (int)pow(2, n) ? printf("equally.\n") : printf("unequally.\n");
    (x >> n) == x / (int)pow(2, n) ? printf("equally.\n") : printf("unequally.\n");
    
    return 0;
}

 

标签:equally,语言,int,scanf,unsigned,printf,include
来源: https://www.cnblogs.com/liujiaxin2018/p/14782423.html