Question

3. (c-program) Write a program that finds the largest and smallest value in a series of numbers entered by a user. The user must enter 25 values. Note if that if the user enters 0 they must correct and add another number. Print out the original entered values, the largest number, the smallest number. Note whether the user tried to enter O.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

int main(){
   int i = 0, n = 25, min, max, val;
   while(i<n){
      printf("Enter number: ");
      scanf("%d",&val);
      if(i == 0){
         min = val;
         max = val;
      }
      if(val != 0){
         i++;
      }
      else{
         continue;
      }
      if(min > val){
         min = val;
      }
      if(max < val){
         max = val;
      }
   }
   printf("Minimun = %d\n",min);
   printf("Maximum = %d\n",max);
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
3. (c-program) Write a program that finds the largest and smallest value in a series of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that finds either the largest or smallest of the ten numbers as command-line...

    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...

  • In C please! Thank you! Write a program that finds the smallest (min), largest (max), and...

    In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...

  • In C++ 2. Write a program that allows the user to enter a series of positive...

    In C++ 2. Write a program that allows the user to enter a series of positive numbers between 1 and 100 and displays the smallest and largest of the numbers entered. The program should not store the numbers that were entered, only keep track of the smallest and largest ones. The program should continue accepting numbers until the value 0 is entered and then display the results. If a number out of range is entered, tell the user it is...

  • In Python 3, Write a program that reads a set of floating-point values. Ask the user...

    In Python 3, Write a program that reads a set of floating-point values. Ask the user to enter the values, then print: The number of values entered. The smallest of the values The largest of the values. The average of the values. The range, that is the difference between the smallest and largest values. If no values were entered, the program should display “No values were entered” The program execution should look like (note: the bold values are sample user...

  • Write a java program making use of methods that finds the smallest of any three numbers...

    Write a java program making use of methods that finds the smallest of any three numbers that the user inputs. You must use JoptionPane to input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.

  • 5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters...

    5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10, and 4 and match the output below. ​ 1 largest = None 2 smallest = None 3 while True: 4...

  • 2) Largest and Smallest Design a program with a loop that lets the user enter a...

    2) Largest and Smallest Design a program with a loop that lets the user enter a series of numbers. The user should enter-99-99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered. a) Use a Do-Until Loop

  • C++ program please. As simple as possible. 1.(40) Write a program that will find the smallest...

    C++ program please. As simple as possible. 1.(40) Write a program that will find the smallest value entered by the user and print out the entered numbers with the smallest value subtracted. The program is to ask for the number of points and then read in that many points.

  • I need to write a program in C that covers this: I need in c language...

    I need to write a program in C that covers this: I need in c language Design a program with a loop that lets the user enter a series of numbers the user should enter -99 to signal the end of the series. after all the numbers have been entered, the program should display the largest and smallest numbers entered.

  • Write a complete C++ program to ask the user to enter 4 integers. The program must...

    Write a complete C++ program to ask the user to enter 4 integers. The program must use a function to find the smallest integer among them and print it on the screen. Typical output screen should be as following: Write a complete C++ program to ask the user to enter 4 integers. The program must use a functionto find the smallest integer among them and print it on the screen. Typical output screen should be as following: Note: the code...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT