Q: Write a C Program to Find Largest Number in Array.
The Basic Logic Behind Finding Maximum Number in Array
- First of all the user will input any 5 numbers in array.
- The program assumes that the first number is maximum number
- max = numArray;
- This C program uses a for loop to get each number in the given array and compare it with current maximum number. If the current item of array is greater than current maximum number, then assign current array item to max
- if( numArray[i] > max)
- max = numArray[i];
- After termination of loop the maximum number will be in max variable.
- Display the value of max variable
The source code of C Program to find and show maximum number in array is: