Here first we take input of list of the numbers then simply by using max() function we can easily find the maximum number between list of the numbers . And we can also find maximum without using max() .For this first we assume that first element of the list is maximum and compare it with all the numbers one by one and if it is less than any number then max_number is equal to that number. By using this we can simply find the maximum among list of numbers. So let's start with the coding.
method 1:-
In this method we simply use max() function which is inbuild function . first we take input a number (number of element in the list ) then list of the numbers . After that by using max() we can simply find the maximum number among the list of the numbers.
Code:-
Output:-
Method 2:-
In this method we will find the maximum without using inbuilt function . For this first we assume first element of the list as a maximum number and store it in max_number and compare it with all the elements and if max_number is less than any number then update max_number by this number.
Code:-
Output:-
Recommended Post:-
- Hackerearth Problems:-
- Very Cool numbers | Hacker earth solution
- Vowel Recognition | Hackerearth practice problem solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem
Hackerrank Problems:-Data structure:-- Playing With Characters | Hackerrank practice problem solution
- Sum and Difference of Two Numbers | hackerrank practice problem solution
- Functions in C | hackerrank practice problem solution
- Pointers in C | hackerrank practice problem solution
- Conditional Statements in C | Hackerrank practice problem solution
- For Loop in C | hackerrank practice problem solution
- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree
0 Comments