Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The pseudocode for finding the sum (total) of a set of floating point numbers stored in an array A, and finding the smallest value of

  1. The pseudocode for finding the sum (total) of a set of floating point numbers stored in an array A, and finding the smallest value of all the data are given as below.

  1. Pseudocode for Sum

Sum(A, N)

sum N

for I 1 to N

sum sum + A[I]

return sum


  1. Pseudocode for smallest

Smallest(A, N)

smallest A[1]

for I 2 to N

if A[I] < smallest

smallest A[I]

return smallest


Write a C++ program will use two functions Sum and Smallest to find the sum and smallest of a set of floating point numbers. Main should declare and get inputs for the array and then call each of the two functions, to find the sum and the smallest values.



  1. The Euclid algorithm for determining the GCD (greatest common divisor) of two integers x and y is described as below:

Euclid (a, b)

while b != 0

c a % b

a b

b c

return a


Write a C++ program with a function written based on the above algorithm. Now call this function suitably by sending two inputs a and b. Before calling the function Euclid, must check if a > b, if not first swap them using a swap function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago