C program to convert octal number to decimal number.

source code


#include<stdio.h>
#include<math.h>
int main()
{
 long int octal,decimal =0;
 int i=0;
  printf("Enter any octal number: ");
  scanf("%ld",&octal);
   while(octal!=0)
{
decimal = decimal + (octal % 10) * pow(8,i++);
octal = octal/10;
}
printf("Equivalent decimal value: %ld",decimal);
getch();
return 0;
}

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.