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]
4 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]4 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
The most basic function of firewalls is to
adelina 88 [10]
<span>A firewall is a network security system that monitors and controls the incoming and outgoing network traffic based on security rules that are configured by the network administrator.</span>
5 0
3 years ago
You are part of which sphere of Earth?
Elden [556K]
We are on the lithosphere
4 0
3 years ago
Read 2 more answers
You can declare new classes as needed; this is one reason java is known as a(n) ________ language.
____ [38]
You can declare new classes as needed : this is one reason java is known as a extensible language.
8 0
3 years ago
Read 2 more answers
The act of deliberately accessing computer systems and networks without authorization is generally known as _____.
Anuta_ua [19.1K]

it is known as hacking

3 0
3 years ago
How is a life cycle analysis used to <br> make decisions about technology?​
kumpel [21]
It is used to assess the environmental impacts of a product, process, or activity. i extracts materials through to processing transport use and disposal
4 0
4 years ago
Other questions:
  • In addition to proposing that planetary orbits are elliptical, what other modification did Kepler make to Copernicus’s model? Pl
    15·2 answers
  • To copy consecutive items, click the first item in the group, hold down _______, and click the last item
    7·2 answers
  • How do you change a Word document to an .html file? Save it as a Web page. Save it as a plain text document. Copy it in rich tex
    14·1 answer
  • Hey can you help we with this thanks
    5·1 answer
  • The filter feature in excel allows you to look at what Data?
    7·1 answer
  • Date Class Constructor – assigns fields to appropriate formal parameter – using the setters so error checking will occur. The co
    6·1 answer
  • Take a list of numbers that range in value from 0 to 9 and output how many occurrences of each number exist.
    12·1 answer
  • Which data type is 2.5?<br> single<br> int<br> float<br> string
    10·1 answer
  • Write down the step to search information internet​
    12·1 answer
  • Rebbeca has finished with the research and outline portion of her slide presentation. Now, the next logical step is to begin wor
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!