Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
Practice Tech Mahindra Essay Topics

Program Discussion :: Basics

Home > Programs > Basics

316 / 259

Write a program using command line argument to input one number and print the Factorial of the number.

Answer:

#include 
#include 

int main(int argc, char * argv[])
{
    int  fact = 1,c = 0, num = 0;
    if(argc == 1 || argc > 2)
    {
         printf("Enter the number \n");
         exit(1);
    }
    num = atoi(argv[1]);
    for (c = 1; c 

Asked In :: TCS

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: