Example 5 to 1
LIST OF PROGRAMS #include<stdio.h> #include<conio.h> void main() { long int n,oct=0,r=1,pow=1; clrscr(); printf("Enter a number "); scanf("%ld",&n); if(n<0) printf("WRONG INPUT"); else { if(n<=7&&n>=0) oct =n; else { while(n>0) { r=n%8; oct=oct+(r*pow); n=n/8; pow=pow*10; } } printf("OCTAL = %ld",oct); getch(); } } LIST OF PROGRAMS
Comments