Answer to Question #295092 in Algorithms for Mitz

Question #295092

1. Design an algorithm and the corresponding flowchart for finding the sum of


the numbers 2, 4, 6, 8, …, n



2. Using flowcharts, write an algorithm to read 100 numbers and then display the


sum.


3. Write an algorithm to read two numbers then display the largest.


4. Write an algorithm to read two numbers then display the smallest


5. Write an algorithm to read three numbers then display the largest.


6. Write an algorithm to read 100 numbers then display the largest.

1
Expert's answer
2022-02-08T10:17:35-0500

Q1






Declare Integer n
Declare Integer i
Declare Integer sum


Display "Ente N: "
Input n
Set sum = 0
Set i = 2
For i = 2 To n Step 2
    Set sum = sum + i
End For
Display "Sum: ", sum



Q2





Declare Integer n
Declare Integer i
Declare Integer sum


Set sum = 0
Set i = 2
For i = 1 To 100
    Display "Enter ", i, ": "
    Input n
    Set sum = sum + n
End For
Display "Sum: ", sum


Q3. 

Declare Integer n1
Declare Integer n2
Display "Enter number 1: "
Input n1
Display "Enter number 2: "
Input n2
if n1>n2 
  Display "The largest: ", n1
else
  Display "The largest: ", n2


Q4. 
Declare Integer n1
Declare Integer n2
Display "Enter number 1: "
Input n1
Display "Enter number 2: "
Input n2
if n1<n2 
  Display "The smallest: ", n1
else
  Display "The smallest: ", n2


Q5. 

Declare Integer n1
Declare Integer n2
Declare Integer n3
Declare Integer largest=-111111
Display "Enter number 1: "
Input n1
if n1> largest
  largest=n1
end if
Display "Enter number 2: "
Input n2
if n2> largest
  largest=n2
end if  
Display "Enter number 3: "
Input n3
if n3> largest
  largest=n3
end if  
Display "The largest: ", largest

Q6. 
Declare Integer n
Declare Integer i
Declare Integer largest=-111111
For i = 1 To 100
  Display "Enter ", i, ": "
  Input n
  if n> largest
    largest=n
  end if
End For
Display "The largest number is: ", largest

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS