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]
3 years ago
6

Input 10 integers and display the following:

Computers and Technology
1 answer:
LekaFEV [45]3 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
Write any two use of computer in school​
igomit [66]

Answer:

To solve mathmatical problem

To make questions paper

7 0
3 years ago
The set of three integer values for the lengths of the sides of a right triangle is called a Pythagorean triple. These three sid
Sloan [31]

Answer:

In Python:

def  Pythagorean_triple(hyp,side1,side2):

   if hyp**2 == side1**2 + side2*2:

       return True

   else:

       return False

               

print("Hypotenuse\tSide 1\t Side 2\t Return Value")

for i in range(1,501):

   for j in range(1,501):

       for k in range(1,501):

           print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))

Explanation:

This defines the function

def  Pythagorean_triple(hyp,side1,side2):

This checks for pythagorean triple

   if hyp**2 == side1**2 + side2*2:

Returns True, if true

       return True

   else:

Returns False, if otherwise

       return False

               

The main method begins

This prints the header

print("Hypotenuse\tSide 1\t Side 2\t Return Value")

The following is a triple-nested loop [Each of the loop is from 1 to 500]

for i in range(1,501): -->The hypotenuse

   for j in range(1,501): -->Side 1

       for k in range(1,501):-->Side 2

This calls the function and prints the required output i.e. the sides of the triangle and True or False

           print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))

8 0
2 years ago
________ can be written only once. The data cannot be erased or written over once it is saved.​
notka56 [123]

Answer:

WORM (Write Once, Read Many)

Explanation:

The full meaning which means Write Once, Read Many implies that data can only be entered (or better put, written) once. Once the data has been written, the data can not be updated or deleted. However, the data being stored on WORM can be read as many times, as possible.

Hence, WORM answers the question.

6 0
2 years ago
Write 8 tips for cyber safety
alina1380 [7]

Answer:

8 tips for cyber safety

1. Keep Personal Information Professional and Limited

2. Keep Your Privacy Settings On

3. Practice Safe Browsing

4. Make Sure Your Internet Connection is Secure. Use a Secure VPN Connection

5. Be Careful What You Download

6. Choose Strong Passwords

7. Make Online Purchases From Secure Sites

8. Be Careful What You Post

8 STEPS TO STOP YOUR CHILD’S CYBERBULLY

Resist The Urge To Respond Or Retaliate

Document The Bullying

Get Help

Block The Bully

Keep Passwords Secret

Be A Teammate

Approach The Parents

Support Your Child With A Stress-Free, Supportive Home

Explanation:

5 0
3 years ago
A(n) _____ chart is drawn on the same worksheet as the data.
Harrizon [31]
The answer is An embedded chart
6 0
3 years ago
Other questions:
  • Which scientific law states that if a light source radiates isotropically, the light intensity falls off the further you get fro
    5·1 answer
  • Which animation effects allow text or images to show movement on a slide? Check all that apply. Entrance, Emphasis, Exit, Motion
    5·2 answers
  • Select the statements that are true regarding the future of technology. Select 2 options.
    10·2 answers
  • In a typical e-mail address, what is the "host"? A. an account designated by a user name. B. the computer that houses an Interne
    7·1 answer
  • You are required to design a 4-bit even up-counter using D flip flop by converting combinational circuit to sequential circuit.
    15·1 answer
  • Drag the correct type of update to its definition.
    13·1 answer
  • 2. Released in 1992, Street Fighter II, the revolutionary fighting game, was developed by which company?
    8·2 answers
  • Pls help I will give points
    11·1 answer
  • Why would over-50 executives have a harder time buying into the idea of social media?​
    15·1 answer
  • What is syllabus of diploma in computer after class 10​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!