Finding the maximum element in an array and returning this element and it's index location in the array. Pseudocode: - #

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Finding the maximum element in an array and returning this element and it's index location in the array. Pseudocode: - #

Post by answerhappygod »

Finding The Maximum Element In An Array And Returning This Element And It S Index Location In The Array Pseudocode 1
Finding The Maximum Element In An Array And Returning This Element And It S Index Location In The Array Pseudocode 1 (17.6 KiB) Viewed 14 times
convert C code to assembly language pls
Finding the maximum element in an array and returning this element and it's index location in the array. Pseudocode: - # Input: Array D, # Output: Maximum element and it's index max=d[0] maxindex=0; For i = 0 to last index of D: if D > max: max=D; maxindex=i; endfor print max and maxindex C-code: =
C-code: int main(void) { int array[] = {10, 2, 7, 5, 15, 30, 8, 6}; // input array int max = array [0]; int maxindex=0; int arraySize = sizeof(array) /sizeof (array[0]); int i=0; for(i=0; i < arraySize; i++) { if(array > max) { max=array; maxindex=i; } } printf ("Max Element is: %d, present at index %d", max, maxindex); return 0; }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply