Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int num, bVal, dVal = 0, base = 1, rem;
- printf("Enter fibinary number: ");
- scanf("%d", &num);
- bVal = num;
- while (num > 0)
- {
- rem = num % 10;
- dVal = dVal + rem * base;
- num = num / 10 ;
- base = base * 2;
- }
- printf("Output: %d \n", dVal);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement