-->

program to convert octal no. into decimal number system.

//program to convert octal no. into decimal number system.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int k=1,m=0,n,rem,decimal=0;
printf("enter octal value/number for 'n'\n");
scanf("%d",&n);
while(n!=0)
   {
      rem=n%10;
      decimal=decimal+rem*pow(8,m);
      n=n/10;
      m++;
   }
printf("decimal is=%d\n",decimal);
getch();
}

logics in mind or applied:-
->if octal number is 234
-> we have to get first 4 and we multiply this with power( you can say increasing or decreasing)of 8
-> we have to add all 
->we display the last value

No comments:

Post a Comment