Write code to find max.number for list,whu this code give no output==
list=[2,8,4]
for i in x:
if i>i-1 and i>i+1:
print(i)
4 Answers
4 years ago by sara mahmoud
int arr[] = {1,2,3,4,5,6}
int maxNum = INT_MIN;
for(int x : arr){
maxNum = max(maxNum,x);
}
cout<<maxNum;
4 years ago by suvansh agrawal
**
- **~~
~~
~~
~~
4 years ago by samarjeet kumar
if you are using Python as language than you can directly use buildin functions of python i.e max
list1 = [1,2,3,4]
print(max(list1))
or else there is another way to do this. You can first sort the list using sort() function and after that print the last element of the list
list1 = [10, 20, 4, 45, 99]
list1.sort()
print("Largest element is:", list1[-1])
4 years ago by Hemendra Chauhdary
Hi,I have seen your question.
If you are using c++,
4 years ago by mm