// convert the given decimal number into binary number
#include <stdio.h>
int main(void)
{
int n;
long int binary = 0;
int remainder, i = 1;
printf("Enter a decimal number: ");
scanf("%d", &n);
while(n != 0)
{
remainder = n % 2;
binary += remainder * i;
n /= 2;
i = i * 10;
}
printf("Equivalent binary number: %d\n", binary);
}
Output:
Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.
thank you brodaa for informative coding
ReplyDeleteWish you successful life ahead!!!