source file name: FactCmdLine.C
// This command line program have main method which uses 2 parameters
void main(int a, char *b[])
{
void fact(int); // prototype of function
int n;
//clrscr();
n=atoi(b[1]);
printf("\n given no : %d ",n);
//scanf("%d", &n);
fact(n);
getch();
}
void fact(int n)
{
int f=1;
for(;n>0;n--)
f=f*n;
printf("\n Factorial value=%d", f);
}
output:
0 Comments
Post a Comment