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
timurjin [86]
3 years ago
8

Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.

after the loop terminates , it prints out, separated by a space and on a single line, the sum of all the even integers read and the sum of all the odd integers read. declare any variables that are needed. assume the availability of a variable , stdin, that references a scanner object associated with standard input.
Computers and Technology
1 answer:
zysi [14]3 years ago
5 0
Procedure SumEvenOdd(stdin: array [0..100] of integer)
var
   i, sum_even, sum_odd: integer;

begin
   for i := 0 to 100 do begin
       if stdin[i] < 0 then
           break;
       if stdin[i] mod 2 = 0 then //even number
          sum_even := sum_even +  stdin[i]
       else 
          sum_odd := sum_odd +  stdin[i]; 

       ShowMessage('sum of even is ' + IntToStr(sum_even) + ' ' + 'sum of odd                                  is' + IntToStr(sum_odd) ) ;
   end; 

end
You might be interested in
For the following array x [10] = { 45, 20, 50, 30, 80, 10, 60, 70, 40, 90} show the contents of x after the function call split
Valentin [98]

Answer:

The array index by using split function.

45 20 50 30 80 10 60 70 40 90

45 20 40 30 80 10 60 70 50 90

45 20 40 30 10 80 60 70 50 90

10 20 40 30 45 80 60 70 50 90

Explanation:

In the following statement, there is an integer array type variable x and its index value is 10 that means it contains only 10 numeric values and then, they set split function which split the array and the split function is the built-in function which is used to separate the string or an array. So, the array is split into the following parts.

5 0
3 years ago
Search engines enable you to
Phoenix [80]

Located web pages related to a specific subject


Please let me know if you have questions !

4 0
3 years ago
An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the ci
WINSTONCH [101]

An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the city police each day since the beginning of the current year.

Explanation:

  • A variable named ndays has been declared and initialized to hold the size of the array.
  • The first element of the array contains the number of tickets given on January 1; the last element contains the number of tickets given today.
  • A variable named mostTickets has been declared, along with a variable k.
  • If today were January 18, ndays would have the value 18; if today were February 3, ndays would have the value 34

mostTickets=0;

for (k=0; k< ndays; k++)

{

if (parkingTickets[k]>mostTickets) mostTickets=parkingTickets[k];

}

3 0
3 years ago
Why are men more exposed to mass media?
adell [148]

Answer:

because they like exploring

8 0
2 years ago
Read 2 more answers
Which statement is false? Classes are reusable software components. A class is to an object as a blueprint is to a house. Perfor
Korolek [52]

Answer:

The last option i.e "A class is an instance of its object" is the correct answer of this question.

Explanation:

A class is a collection of variable and method . The class is the blueprint of the object that means class is physical space entity and object is a runtime space entity.It is the the reusability feature of the programming component.

Following are the  syntax to declare any class.

                     Class classname

<u>For Example</u>: class test1

With the help of class we can achieve the inheritance, encapsulation and abstraction etc.

All the other options except the last one are correct option. Because option(1), option(2) and option(3) follow the property of class and object .  that's why last option is False.

4 0
3 years ago
Other questions:
  • Which of the following is NOT a function of the Web Accessibility Initiative​ (WAI)? A. Offering links to a variety of software
    10·1 answer
  • John was carrying on at the water cooler the other day, trying to show off his knowledge of networking. He claimed that the comp
    10·1 answer
  • You are part of the team to implement new software at XYZ Inc. The employees at XYZ Inc. trust the results of the old software p
    15·1 answer
  • Any recommendations for anime series on netflix?
    14·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    7·1 answer
  • A solid understanding of __________ is the foundation of verbal communication
    7·1 answer
  • If you wish to sign out of your Microsoft account, tap or click ____ on the ribbon to open the Backstage view and then tap or cl
    10·1 answer
  • What is the meaning of the term plot?<br>A. the final outcome of the story​
    8·1 answer
  • If you can name this you get 15 points: ↑↑↓↓←→←→βα
    10·1 answer
  • Julie is purchasing new shoes on a website for her favorite store. Which of the following would indicate that a website is a sec
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!