Command Line Program to Convert Binary to Octal

C Programming Language Command Line Arguments (Article) Command Line Arguments (Program)

1030

Program:

#include<stdio.h>
void main(int argc,char *argv[])
{ 
   long int n,r,c,b=1,s=0;
    n=atoi(argv[1]);
    c=n;
    while(c!=0)
    {
    r=c%10;
    s=s+r*b;
    c=c/10;
    b=b*2;
	}
	printf("%lo",s);
	getch();
}

Output:

1010

12

Explanation:

Nope

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.