0
Hello good afternoon any one please tell me the Largest number printing program logic
4 Réponses
+ 10
Hello,
To Find The Largest Number From A List Of Given Set Of Numbers [array of numbers] Follow The Below Steps :
> Initialize a variable max=0
> Repeat the below step for all the numbers in the list [Use loop for this]
> Check if max < the list number. If yes then assign the value of the current list number to max.
> After completing all the numbers of list, you will get the maximum value in the max variable. Then display the max variable.
+ 2
Initializing with 0 is critical due the largest number may be -7. Set it to the first number in your array instead.
+ 2
numbers = [6, 2, 4, 7, 1, 9, 3]
max = numbers[0]
for num in numbers:
if num > max:
max = num
print(max)
That's it 😊
- 1
ok then tell me program