Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you help write this in C language DEV compiler because I'm using it. thanks. Write a program that reads multiple integers from the user

image text in transcribed

Can you help write this in C language DEV compiler because I'm using it. thanks.

Write a program that reads multiple integers from the user and finds the two largest values. The program ignores negative values and prints a message indicating so. The sentinel is -1. If the largest value or the second largest value occur multiple times, they are counted counted once, as in the sample below. If no valid input was entered, or only one valid input was entered the program should print a message indicating so. Use a flag variable that could be (0, 1, 2) to indicate that no input was entered so far, one valid input was entered so far, or two or more valid input were entered so far. Enter integer: 3 Enter integer: -12 >>> Invalid input! Enter integer: 40 Enter integer: 12 Enter integer: 40 Enter integer: 30 Enter integer: -1 The two largest values are: 30 and 40. Enter integer: -15 >>> Invalid input! Enter integer: -12 >>> Invalid input! Enter integer: 6 Enter integer: -1 Only one valid value was entered: 6

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions