TCS Command Line Arguments for Greatest of Two Numbers

Find Greatest of two number using command Line programming?

Note: Please go through Command Line Arguments Post before preparing for these questions. The theory there  for TCS command line Program will help you in better understanding .

#include <stdio.h>

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


int c[10];

int i,temp,j,greatest;

j = 0;

for(i=1; i<argc; i++)


temp = atoi(argv[i]);

c[j] = temp;



greatest = c[0];

for (i = 0; i < 10; i++) {

if (c[i] > greatest) {

greatest = c[i];



printf("Greatest of ten numbers is %d", greatest);

return 0;