Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Plz write codes in C Array Manipulation (LargestArray.c) Write a program, Larges

ID: 3714482 • Letter: P

Question

Plz write codes in C

Array Manipulation (LargestArray.c) Write a program, LargestArray.c, which asks the user to input values for in a 1 dimensional array. First, ask they user how many values they would like to enter, then use a FOR loop to enter each value in the array. Finally, use a loop to determine which element in the array is the largest. Write an output that states what the largest element is and which position it is in. An example of the command window after running this program is shown below. 3. Enter how many numbers you want to process: 4 Enter number: 25 Enter number: 34.1 Enter number 26.7 Enter number: 48.3 Largest element 48.30 The eïement is saved in index # 3

Explanation / Answer

ANSWER:-

#include <stdio.h>

int main() {

int n,index;

printf("enter how many numbers you want to process : ");

scanf("%d",&n);

float arr[n];

for(int i=0;i<n;i++)

{

printf("enter number : ");

scanf("%f",&arr[i]);

}

float max=arr[0];

for(int i=0;i<n;i++)

{

if(arr[i]>max)

{

max=arr[i];

index=i;

}

}

printf("largest element : %.2f",max);

printf(" the element is saved in index # %d",index);

return 0;

}

// OUTPUT

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote