Flowchart to find largest element in an array in python

Flowchart to find largest element in an array in python

  1. Develop a flowchart to find largest element in an array.

Aim: To  draw the flowchart for finding largest element in the array.

Algorithm:

Step1: Start

Step2: Enter the array size and read as n.

Step3: Enter the array elements and read as a[i].

Step4: Initialize to i and a[i] to large.

Step5: In i loop check the condition i>n-1.

Step6: check the condition a[i+1]>large

Step7: If the condition is true then assign a[i+1] to large, otherwise go to next iteration.

Step8: Print the largest element

Step 9: End

Flowchart:

Flowchart to find largest element in an array in python

Source Code:

# Find max and min
num1=[163,45,28,85,214,101]
print(“Minimum value is:”,min(num1))
print(“Maximum value is:”,max(num1))
# ………………………

# 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))
# ………………………………………………………..

# 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))

Related Link:

Flowchart to sort the list of numbers in python-my programming school

Flowchart for swapping two values using functions in python

Flowchart to display the reverse of a number in python

Flow chart to check odd and even number

Flowchart to find largest element in an array in python

Flowchart to find Minimum and Maximum Numbers in an Array

Leave a Comment

Your email address will not be published. Required fields are marked *