Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int octal, decimal, i, j;
- printf("Enter the octal number : ");
- scanf("%d", &octal);
- decimal = 0;
- i = 0;
- while(octal != 0)
- {
- j = octal % 10;
- decimal += j * pow(8, i);
- octal /= 10;
- i++;
- }
- printf("\nThe decimal is : %d\n", decimal);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement