how to find the maximum of 10 numbers ?

Answer Posted / namitha

#include<iostream.h>

main()
{
int a[10],n;
cout<<"enter ten numbers:\n";
for(int i=0;i<10;i++)
{
cin>>a[i];
}
int max=a[0];
for(i=0;i<10;i++)
{
if(a[i]>max)
max=a[i];
}
cout<<"the maximum number is:"<<max<<endl;
}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of structure in c++?

565


why and when we can declar member fuction as a private in the class?

1614


Discussion on error handling of C++ .

660


Explain binary search.

587


Explain differences between alloc() and free()?

586






What is the hardest coding language to learn?

618


Why is c++ is better than c?

523


What things would you remember while making an interface?

573


If you don’t declare a return value, what type of return value is assumed?

549


How to declaring variables in c++?

672


Why do we use classes in programming?

582


What does ios :: app do in c++?

564


In the derived class, which data member of the base class are visible?

652


Explain rethrowing exceptions with an example?

616


Is c++ built on c?

575