Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Write a program to convert a decimal number to its binary equivalent.
- #include<stdio.h>
- int main()
- {
- int n = 1000005, ar[50], count = 0;
- while(n != 0)
- {
- ar[count] = n % 2;
- count++;
- n /= 2;
- }
- for (int i = count-1; i >= 0; --i)
- {
- printf("%d", ar[i]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment