-->
Showing posts with label decimal to octal conversion. Show all posts
Showing posts with label decimal to octal conversion. Show all posts

program to convert decimal into octal

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