68 355
Assignments Done
98,7%
Successfully Done
In November 2018

Answer to Question #18915 in C++ for BloodFiend

Question #18915
a program that take 8 different values from a user . List the values in reverse order and display the largest number entered.

Please and Thanks!

it's C programming. i couldn't choose C in the category list.
Expert's answer
int arrayofnumbers[20];

double Maximum();

int main()
{



for(int i=0;i<8;i++){
printf("Enter number %d: ",(i+1));
scanf("%d",&arrayofnumbers[i]);
}
for(int i=7;i>=0;i--){
printf("
Number %d: is: %d",(i+1),arrayofnumbers[i]);
}

printf("
The largest number entered = %f",Maximum());



printf("
Press any key to exit...");
scanf("%d",&arrayofnumbers[0]);

return 0;
}


double Maximum(){
double maximum=arrayofnumbers[0];
for(int i=0;i<20;i++){
if(arrayofnumbers[i]>maximum){
maximum =arrayofnumbers[i];
}

}
return maximum;

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
21.11.12, 14:31

You're welcome. We are glad to be helpful.
If you really liked our service please press like-button beside answer field. Thank you!

BloodFiend
21.11.12, 09:32

thanks a lot!
had to make 2 changes to get it to compile ... by declaring the variable i outside the for loop.
Was getting G99 errors.
once again thanks.

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions