Command Line Program to Convert Decimal to Octal

C Programming Language / Command Line Arguments

463

Program:

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

Output:

10

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.