An array is given for 15 values. Take the absolute values for every three numbers in the array, going one after the other, and calculate the area of a triangle with sides, the values of which correspond to the taken numbers. Create a new array in which to enter the values of the resulting areas. Display all areas on the screen:
I know how to calculate the areas, etc. But I don't know how to organize right nested loops.
Could you explain it?
My example:
int numbers[15]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 3; j++) {
}
}
for (int i = 0; i < 15; i += 3). Inside that loop usenumbers[i],numbers[i + 1], andnumbers[i + 2]as side values.