0

Hello good afternoon any one please tell me the Largest number printing program logic

14th May 2019, 7:04 AM
balivada tarun kumar
4 Antworten
+ 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.
14th May 2019, 7:19 AM
Nova
Nova - avatar
+ 2
Initializing with 0 is critical due the largest number may be -7. Set it to the first number in your array instead.
14th May 2019, 7:26 AM
Daniel Adam
Daniel Adam - avatar
+ 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 😊
14th May 2019, 7:45 AM
Muhammad Tahir Iqbal
Muhammad Tahir Iqbal - avatar
- 1
ok then tell me program
14th May 2019, 7:28 AM
balivada tarun kumar