C Program Decimal number to Octal Conversion | Decimal to Octal Conversion in C | C Language assignment to convert Decimal Value to Octal Value
#include#include #include void dec_oct(long int num) // Function Decl. { long int rem[50],i=0,length=0; while(num>0) { rem[i]=num%8; num=num/8; i++; length++; } printf("\n Converted Octal number is : "); for(i=length-1;i>=0;i--) printf("%ld",rem[i]); } void main() { long int num; clrscr(); printf("Enter the decimal number : "); scanf("%ld",&num); dec_oct(num); // Calling function getch(); }
No comments:
Post a Comment