UnityOneLoveOk
New member
- Joined
- Oct 22, 2024
- Messages
- 3
- Programming Experience
- Beginner
Hey guys!
There's already registered value 0,1,2. I want even indexes to multiply even indexes. And i want odd indexes to addict odd indexes. GPT doesn't give me a solution, can you help me with code? Like it has to go like this if indexEnter is 10 : 10 20 20 40 400 80 1600
C#:
int[] arraySupporter = {
0,
1,
2
};
array[0] = indexEnter;
int temp = array[0];
int tempSecond = 0;
if (array.Length > 1) {
array[1] = array[1 - 1] * 2;
array[2] = array[2 - 2] * 2;
}
for (int i = 0; i < array.Length; i++) {
if (i % 2 == 0 && i < 5) {
array = array * temp;
temp = array;
} else {
array = array + tempSecond;
tempSecond = array;
}
Last edited by a moderator: