Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

do not add a function declaration or change the parameters thank you 2. (40 points) Write a program that finds either the largest or smallest

do not add a function declaration or change the parameters thank you 2. (40 points) Write a program that finds either the largest or smallest of the ten numbers as command-line arguments. With l for largest and s for smallest number, if the user enters an invalid option, the program should display an error message. Example runs of the program: ./find_largest_smallest l 5 2 92 424 53 42 8 12 23 41 output: The largest number is 424 ./find_largest_smallest s 5 2 92 424 53 42 8 12 23 41 output: The smallest number is 2 1) Name your program numbers.c. 2) Use atoi function in to convert a string to integer form. 3) Generate the executable as find_largest_smallest.

int l = 0; int s = 0 int i; if(strcmp(argv[1],"-l")==0) { for(i=1;il) { l=atoi(argv[i]); } } printf("The Largest Number is %d ",l); } else if(strcmp(argv[1],"-s")==0) { for(i=1;i

need the right initialization. then the program should work with correct values. can anyone help?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions