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
Brrunno [24]
4 years ago
6

Input 10 integers and display the following:

Computers and Technology
1 answer:
LekaFEV [45]4 years ago
3 0

Answer:

// code in C++

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int sum_even=0,sum_odd=0,eve_count=0,odd_count=0;

   int largest=INT_MIN;

   int smallest=INT_MAX;

   int n;

   cout<<"Enter 10 Integers:";

   // read 10 Integers

   for(int a=0;a<10;a++)

   {

       cin>>n;

       // find largest

       if(n>largest)

       largest=n;

       // find smallest

       if(n<smallest)

       smallest=n;

       // if input is even

       if(n%2==0)

       {  

           // sum of even

           sum_even+=n;

           // even count

           eve_count++;

       }

       else

       {

           // sum of odd    

          sum_odd+=n;

          // odd count

          odd_count++;

       }

   }

   

   // print sum of even

   cout<<"Sum of all even numbers is: "<<sum_even<<endl;

   // print sum of odd

   cout<<"Sum of all odd numbers is: "<<sum_odd<<endl;

   // print largest

   cout<<"largest Integer is: "<<largest<<endl;

   // print smallest

   cout<<"smallest Integer is: "<<smallest<<endl;

   // print even count

   cout<<"count of even number is: "<<eve_count<<endl;

   // print odd cout

   cout<<"count of odd number is: "<<odd_count<<endl;

return 0;

}

Explanation:

Read an integer from user.If the input is greater that largest then update the  largest.If the input is smaller than smallest then update the smallest.Then check  if input is even then add it to sum_even and increment the eve_count.If the input is odd then add it to sum_odd and increment the odd_count.Repeat this for 10 inputs. Then print sum of all even inputs, sum of all odd inputs, largest among all, smallest among all, count of even inputs and count of odd inputs.

Output:

Enter 10 Integers:1 3 4  2 10 11 12 44 5 20                                                                                

Sum of all even numbers is: 92                                                                                            

Sum of all odd numbers is: 20                                                                                              

largest Integer is: 44                                                                                                    

smallest Integer is: 1                                                                                                    

count of even number is: 6                                                                                                

count of odd number is: 4

You might be interested in
Summarize why understanding the differences between surface culture and deep culture may inform your knowledge, skills, and prof
lorasvet [3.4K]

Answer: By understanding the basic cultural values of the individual such as looks and talk. Also understanding the core values of the individual such as attitude, beliefs and religion. It would improve the behavior in your professional and cultural relationship with individuals in your workplace.

Explanation:

8 0
3 years ago
What is the keyboard shortcut for opening the edit hyperlink dialog box
Mademuasel [1]

That would be CTRL+K


https://quizlet.com/122913134/keyboard-shortcuts-flash-cards/


hope this helps!

7 0
3 years ago
True or False? To reduce hazards, flexible cords must connect to devices and fittings in ways that prevent tension at joints and
jek_recluse [69]
The Right Answer Is True.

3 0
4 years ago
he World Wide Web Consortium recommends that all style informa- tion about a document should be stored in a separate style sheet
Solnce55 [7]

Answer:

  • Allows the style to be reused across multiple pages, giving the website a consistent look
  • Improved web page load times as the CSS file is only downloaded once

Additional Detail:

The Cascading Style Sheet (CSS) file is used in web pages to define features such as font, color, spacing.

5 0
3 years ago
What is the generic term for a device that stores images for long periods of time?
Artemon [7]
I would say 1. Backup drive.
7 0
3 years ago
Read 2 more answers
Other questions:
  • Content controls cannot be removed, only edited. Please select the best answer from the choices provided
    10·1 answer
  • ________ is a wireless protocol designed for transmitting data over short distances, replacing cables. ipv6 ipv4 paas bluetooth
    11·1 answer
  • What type of interview would be most likely for the following scenario?
    11·2 answers
  • Explain why Windows and Linux implements multiple locking mechanisms. Describe the circumstances under which they use spinlocks,
    13·1 answer
  • Which one of them are the correct answers?
    7·1 answer
  • Which expression correctly determines that String s1 comes before String s2 in lexicographical order
    6·1 answer
  • Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the program outputs the sum of
    15·1 answer
  • g Consider a disk queue with requests for I/O to blocks on cylinders 95, 120, 41, 122, 15, 142, 65, 167. The Shortest Seek Time
    12·1 answer
  • Write a program that prompts the user to enter a fraction in the following format (x/y). You may assume that the user will input
    15·1 answer
  • Order the steps for creating an automatic reply in Outlook.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!