Flowchart to find largest element in an array in python

Flowchart to find largest element in an array in python

Develop a flowchart to find the largest element in an array in python. In this, we have to find the largest element which is entered by the user. we will also see max and min difference and max and min using def.

Aim to find max in list Python

In this program, we will learn to draw the flowchart for finding the largest element in the array.

Algorithm to find largest element in an array

  • Step-1: Start
  • Step-2: Enter the array size and read as n.
  • Step-3: Enter the array elements and read as a[i].
  • Step-4: Initialize to i and a[i] to large.
  • Step-5: In i loop check the condition i>n-1.
  • Step-6: check the condition a[i+1]>large
  • Step-7: If the condition is true then assign a[i+1] to large, otherwise go to next iteration.
  • Step-8: Print the largest element in an array in python
  • Step- 9: End

Diagram of flowchart to find largest element

Flowchart to find largest element in an array in python

Python program to find largest number in an array

Find maximum and minimum number using max() and min() function

num1=[163,45,28,85,214,101]
print("Minimum value is:",min(num1))
print("Maximum value is:",max(num1))
# ...........................

max() and min() function

Find max and min difference

def max_Min_diff(num):
return max(num) - min(num)
num1=[163,45,28,85,214,101]
print("The difference of max and min is:",max_Min_diff(num1))
# .................................................................

Find max and min difference

Max and Min using def

def max_min(num):
return "maximum:->",max(num),"minimum:-> ",min(num)
num1=[163,45,28,85,214,101]
print(max_min(num1))
# .................................................................
Max and Min using def

Recommended Posts:

Get Salesforce Answers

Pramod Kumar Yadav is from Janakpur Dham, Nepal. He was born on December 23, 1994, and has one elder brother and two elder sisters. He completed his education at various schools and colleges in Nepal and completed a degree in Computer Science Engineering from MITS in Andhra Pradesh, India. Pramod has worked as the owner of RC Educational Foundation Pvt Ltd, a teacher, and an Educational Consultant, and is currently working as an Engineer and Digital Marketer.



Leave a Comment