Arrays task
#1

Hello guys, I have been given some tasks to do, and I need help with the final task
Alright here's an explanation for the task:
I have a 10 cells array called Arr, and it contains the numbers
7,2,5,1,3,8,6,3,4,6
Now I have to transfer the dual numbers to the right side of the array (Arr[5-10])
and the odd numbers to the left side.
Thats the code:
PHP код:
// Task 4
    
for(new 510i++)
    {
        for(new 
0sizeof(Arr); j++)
        {
            if(
Arr[j] % == && Arr[i] != Arr[j]) Arr[i] = Arr[j];
        }
    }
    for(new 
05i++)
    {
        for(new 
0sizeof(Arr); j++)
        {
            if(
Arr[j] % != && Arr[i] != Arr[j]) Arr[i] = Arr[j];
        }
    }
    for(new 
0sizeof(Arr); k++) printf("Arr[%i] = %d"kArr[k]); 
And thats the print:
Код:
[22:50:36] Arr[0] = 3
[22:50:36] Arr[1] = 3
[22:50:36] Arr[2] = 3
[22:50:36] Arr[3] = 3
[22:50:36] Arr[4] = 3
[22:50:36] Arr[5] = 6
[22:50:36] Arr[6] = 6
[22:50:36] Arr[7] = 6
[22:50:36] Arr[8] = 6
[22:50:36] Arr[9] = 6
Anyone help ?
Reply


Messages In This Thread
Arrays task - by NeXoR - 29.09.2016, 20:02
Re: Arrays task - by SickAttack - 29.09.2016, 20:18
Re: Arrays task - by NeXoR - 29.09.2016, 20:29
Re: Arrays task - by NeXoR - 29.09.2016, 20:31
Re: Arrays task - by SickAttack - 29.09.2016, 20:58
Re: Arrays task - by NeXoR - 30.09.2016, 04:56

Forum Jump:


Users browsing this thread: 2 Guest(s)