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 are friend classes?

607


What is the main function c++?

586


Why do you use the namespace feature?

642


Write a C++ Program to check whether a number is prime number or not?

625


What is the use of map in c++?

601






What is bubble sort c++?

570


What do you mean by late binding?

614


Explain "const" reference arguments in function?

604


What are 2 ways of exporting a function from a dll?

609


What are friend functions in C++?

617


the maximum length of a character constant can be a) 2 b) 1 c) 8

600


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

536


Write my own zero-argument manipulator that should work same as hex?

573


what are the decision making statements in C++? Explain if statement with an example?

650


What is the use of function pointer?

568