TCS Command Line Program for Decimal to Octal

Note: Please go through Command Line Arguments Post before preparing for these questions. The theory there  for TCS command line Program will help you in better understanding .

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