Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please see photo below Develop a program that uses a loop to find the largest nu

ID: 3540009 • Letter: P

Question

please see photo below


Develop a program that uses a loop to find the largest number from all numbers entered by the user. The program can ask the user for total numbers to process at beginning OR ask the user the choice of entering another number after a number is entered. -identify the following four elements for the loop to be used in the program Initial statement(s) condition(s) Loop statement(s) Update statement(s) -type the C++ codes to implement the loop planned above by using a for loop a while loop a do..while loop -complete the program with one loop type of your choice from above codes

Explanation / Answer

#include <iostream>


using namespace std;


int main()

{

int a;

int b=0;//initial statement

int c;

int i;//condition


cout<<"How many numbers you want to compare ";

cin>>c;

cout<<"Enter the numbers ";

for(i=0;i<c;i++)//loop statement and i++ update statement

{

cin>>a;

while(a>b)

{

b=a;

}

}

cout<<"Greatest number="<<b<<endl;

}