write a function that takes an integer array as an input and
finds the largest number in the array. You can not sort
array or use any API or searching needs?

Answer Posted / pawan

#include<iostream>
using namespace std;

int main()
{
int name[5],big,i;

for(i=0; i<=4; i++) {
cout << "Enter a value" << i << ":";
cin >> name[i];
}
cout << "name contains:";
for(i=0; i<=4; i++) {
cout << name[i]<< "\n";
}

big = name[0];
for(i = 0; i <= 4; i++) {
if(name[i] > big)
big = name[i];
}

cout << "The Bigest Number::" << big << endl;

return 0;
}

Is This Answer Correct ?    39 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1145


What is abstraction with example?

601


Can main method override?

583


What polymorphism means?

620


What is polymorphism and its types?

591






What are benefits of oop?

632


Can we create object of interface?

601


What is encapsulation with real life example?

566


Why do we use inheritance?

628


What is object in oop with example?

695


What is the main feature of oop?

618


Why do while loop is used?

571


What is encapsulation and abstraction? How are they implemented in C++?

632


what type of question are asked in thoughtworks pair programming round ?

1756


What are the advantages of polymorphism?

573