1d Arrays
| cliffy (1) |
|
|
Write a program with 1d array with 50 elements.The program should find the maximum and minimum value.Find the average
|
|
|
| ajh32 (85) |
|
|
So @cliffy what have you tried to do so far? Care to share the code with us?
|
|
|
| Filiprei (132) |
|
Is this homework?
I can give you some hints, you can use
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
for(int i = 0;i < 50;i++)
{
if(max < arr[i])
{
max = arr[i];
continue;
}
else if(min > arr[i])
{
min = arr[i];
continue;
}
else
continue;
}
|
BTW, this has some flaws, but since this is your homework not mine you should try to make it idiot proof, not me!
|
|
Last edited on
|