[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Basics

Home > Programs > Basics

316 / 279

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: