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