รบกวนวิธีทำโค้ดแรกแสดงผลต่อกับโค้ดสองทำไงครับ

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

int main()
{
    double num, power, n;

    printf("ค่าที่ต้องการ : ");
    scanf("%lf", &num);

    printf("ค่าที่ยกกำลัง : ");
    scanf("%lf", &power);

    n = pow( num, power );

    printf("%.2lf ยกกำลัง %.2lf เท่ากับ %.2lf", num, power, n);
    
    
}


#include<stdio.h>
 
int main()
{
    int dec;
    int bin[100];
    int i=0, j;
     
    printf(" Input Decimal value : ");
     
    scanf("%d", &dec);
     
    do
    {
        bin = dec % 2;
        dec /= 2;
        i++;
    }while(dec > 0);
 
 
    printf("\n Binary value is ");
     
    for(j = i - 1; j >= 0; j--)
    {
        printf("%d", bin[j]);   
    }
     
    return 0;
}
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่