Wednesday, December 26, 2012

Decimal number to Octal number conversion using C language


#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,n1,o=0,r,p=0;
printf("\n Enter the number to convert octal number");
scanf("%d",&n);
n1=n;
while(n>0)
{
r=n%8;
n=n/8;
o=o+r*pow(10,p);
p++;
}
printf("\n The octal equivalanet number of %d is %d",n1,o);
printf("\n Press any key to exit");
getch();
}

No comments:

Post a Comment

DC motor control with Pulse Width Modulation Part 1

DC Motor intro DC motor is a device which converts electrical energy into kinetic energy. It converts the DC power into movement. The typica...