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; }
Finding the maximum element in an array and returning this element and it's index location in the array. Pseudocode: - #
-
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: - #
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!