Name this program limits c The program looks at all the com
Solution
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int i,largest,smallest,count;
largest=0;
smallest=999;
int array[10];
if (argc < 2)
{
printf(\"Not enough arguments entered\ \");
exit(1);
}
for(i = 0; i < argc; i++)
array[i] = atoi(argv[i]);
count=i;
for(i=0;i<=count;i++)
{
if(array[i]>largest)
largest=array[i];
if(array[i]<smallest)
smallest=array[i];
}
printf(\"\ Smallest Number=%d\",smallest);
printf(\"\ Largest Number=%d\",largest);
return 0;
}
output:
sh-4.3$ main 89 67 -56 45 88
Smallest Number=-56
Largest Number=89
