#include <stdio.h>
#include <conio.h>
void main()
{
int a,no[100],i,c,n=0;
clrscr();
printf("\nEnter Decimal Number: ");
scanf("%d",&a);
for(i=0;a!=0;++i)
{
c=a%8;
no[i]=c;
a=a/8;
++n;
}
printf("\nThe Octal equivalant of decimal number is: ");
for(i=n-1;i>=0;--i)
{
printf("%d",no[i]);
}
getch();
}
#include <conio.h>
void main()
{
int a,no[100],i,c,n=0;
clrscr();
printf("\nEnter Decimal Number: ");
scanf("%d",&a);
for(i=0;a!=0;++i)
{
c=a%8;
no[i]=c;
a=a/8;
++n;
}
printf("\nThe Octal equivalant of decimal number is: ");
for(i=n-1;i>=0;--i)
{
printf("%d",no[i]);
}
getch();
}
No comments:
Post a Comment