Ques. Write a Program Fibonacci Series Using Command Line Arguments for TCS?

Below is the code for Fibonacci Series Using Command Line Arguments for TCS preparation made easy.

It is highly advisable to go through Command Line Arguments Post before even looking at the code. Please study this for TCS and come back to this post later.


int main(int argc, char *argv[])


int n, first = 0, second = 1, next, c;

n = atoi(argv[1]);

printf("These are %d values in Fibonacci series are by PrepInsta:-\n",n);

for ( c = 0 ; c < n ; c++ )


if ( c <= 1 )

next = c;



next = first + second;

first = second;

second = next;




return 0;


Other TCS Coding Questions –

Review Date
Reviewed Item
Command Line Argument Fibonacci
Author Rating