LOOP SET2

Organizers:


Problems

Problem Points AC Rate Users
mm and print first diagonal 10 19.5% 24

Comments


  • 0
    DEEKSHITHA  commented on April 10, 2023, 4:52 p.m.

    include<stdio.h> int main() { int decimal_num, remainder, quotient, binary_num = 0, i = 1;

    scanf("%d", &decimal_num);
    
    quotient = decimal_num;
    
    while (quotient != 0) {
        remainder = quotient % 2;
        quotient = quotient / 2;
        binary_num += remainder * i;
        i *= 10;
    }
    
    printf("%d",binary_num);
    
    return 0;

    }