Command Line Program to Convert Binary to Octal

This is a very smart program very short and quick method –

#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();
}