Arrays task
#2

pawn Код:
new array[] = {7, 2, 5, 1, 3, 8, 6, 3, 4, 6}, count, temp;
for(new i = 0; i < sizeof(array); i ++)
{
    if(array[i] % 2)
    {
        temp = array[count];
        array[count ++] = array[i];
        array[i] = temp;
    }
}

for(new i = 0; i < sizeof(array); i ++)
{
    printf("%d", array[i]);
}
7 (odd)
5 (odd)
1 (odd)
3 (odd)
3 (odd)
8
6
2
4
6

What's the task for, if I may ask?
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: 3 Guest(s)