Write a program that first fills the array with up to 20


Assignment:
Let arr be an array of 20 integers. Write a program that first fills the array with up to 20 input values and then finds and displays both the subscript of the largest item in arr and the value of the largest item.

Will the following meet this assigned project? I am new to C++ programming and just want to make sure I am not simplifying this code too much. Thanks.

#include

#define Arr_size 20

int main(void) 
{
int high=0,input[Arr_size],val;
printf("Please give 20 random valuesn");

for(val=0;val< Arr_size;val++) 
{
printf("Value #%i : ",val+1);
scanf("%i",&input[val]);
printf("n");
}

printf("nn");
for(val=0;val< Arr_size;val++) 
{
printf("Value #%i : %in",val+1,input[val]);
if(input[val]>high) high=input[val];
}

printf("The largest value given was %dn",high);

return (0);

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a program that first fills the array with up to 20
Reference No:- TGS0144232

Expected delivery within 24 Hours