1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zalisa [80]
3 years ago
7

Write and application that reads five integers from the user and determines and prints the largest and the smallest integers. Us

e only the programming techniques your learned in this chapter (use only if statements) 1.2. Modify your first program to add 2 more functions, the first function should determines the largest number and the second smallest. Both new functions must get invoked from the main function.
Computers and Technology
1 answer:
mixas84 [53]3 years ago
5 0

Answer:

#include <stdio.h>  

#include <limits.h>  

 

/* Define the number of times you are going  

  to ask the user for input. This allows you  

  to customize the program later and avoids the  

  hard coding of values in your code */  

#define NUMVALS 5  

 

int main(void)  

{  

   int i = 0;  

   int curval = 0;  

   /* Set your initial max as low as possible */  

   int maxval = INT_MIN;  

   /* Set your initial min as high as possible */  

   int minval = INT_MAX;  

 

   /* Loop through and ask the user for the defined  

      number of values */  

   for (i = 0; i < NUMVALS; i++)  

   {  

       /* Ask the user for the next value */  

       printf("Enter the next value: ");  

 

       /* Get the next value from the user */  

       scanf("%d", &curval);  

 

       /* Check to see if this is our biggest or  

          smallest value yet */  

       if (curval > maxval)maxval = curval;  

       if (curval < minval)minval = curval;  

   }  

 

   /* Output the results */  

   printf("The smallest value entered was: %d \n", minval);  

   printf("The largest value entered was: %d \n", maxval);  

 

   /* End the program */  

   return 0;  

}

Explanation:

You might be interested in
In what ways was the first Mac OS different from the operating systems used by most early PCs? Users clicked on pictures to laun
777dan777 [17]

Users didn't have to memorize lots of commands.

3 0
3 years ago
13. In cell A17, use the SUMIF function to display the total membership in 2023 for groups with at least 40 members
expeople1 [14]

Answer:

On cell G16, type the formula "=SUMIF(G2:G11, ">=40")".

Explanation:

Formulas in Microsoft Excel are used to generate results or values to a cell. The formula must start with an equal sign. The formula above has the function "SUMIF" which is used to provide a sum of numeric values based on a condition.

6 0
3 years ago
What is the most accurate way to describe the excerpt?
kifflom [539]

choose the option it is a dependent clause

7 0
4 years ago
Read 2 more answers
Ai biết cách tra code đáp án trên LMS, Moodle/Quiz không ạ??
mariarad [96]

Answer:

không nhé học đi bạn đừng có cheat hỏng người đấy

Explanation:

4 0
3 years ago
Given that an integer variable i and a floating-point variable f have already been declared and given values: Write a statement
Wewaii [24]

Answer:

Follows are the given statement to this question:

printf("i=%d f=%f", i, f);//print value

Explanation:

The full code to the given question:

code:

#include <stdio.h>//defining header file

int main()// main method

{

   int i;//declaring integer variable

   float f;//declaring float variable

   i=25; //assign integer value

   f=12.34;//assign float value

   printf("i=%d f=%f", i, f);//print value

   i=703;//assign integer value

   f=3.14159;//assign float value

   printf("\n");//for line break

   printf("i=%d f=%f", i, f);//print value

   return 0;

}

Output:

i=25 f=12.340000

i=703 f=3.141590

In the above-given code, the two variable "i and f" is declared, that holds integer and floating-point value in its respective variable and use the print method, to print "i and f" variables value.  

6 0
3 years ago
Other questions:
  • How does a saffir put out fires
    12·1 answer
  • These statements describe the NOS.(choose all that applies)
    13·2 answers
  • You try to enter your name into a cell that accepts a numeric value. What error would you receive? A. #NAME B. #VALUE C. #REF D.
    14·2 answers
  • Define an organizational unit in your own words.
    11·1 answer
  • Computer hardware without software is usless and compyrersoftware without hardware is meaningless discuss
    6·1 answer
  • Which of these did the author use to create certain moods?
    6·1 answer
  • The physical parts of a computer are called application software.
    9·2 answers
  • Contrast between functions of sort and sorted in python . ​
    10·1 answer
  • Explain the relationship between one’s point of view and understanding spoken text
    13·1 answer
  • write an assembly program that uses the output compare function of a timer to toggle an led every second
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!