C-Programs
Wednesday, 6 September 2017
C-Program Convert Decimal to Octal
#include<stdio.h>
int main()
{
int dec,temp,i,j=1,octal=0;
printf("Enter the decimal number : ");
scanf("%d",&dec);
temp=dec;
while(temp!=0)
{
i=temp%8;
octal=octal+(i*j);
temp=temp/8;
j=j*10;
}
printf("Octal number : %d\n",octal);
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment