The odd numbers array is grouped in this way: first
number is the first group, the next 2
numbers form the 2nd group, the next 3
numbers form the 3rd group and so on.
Groups:
- 1
- 3 5
- 7 9 11
- 13 15 17 19
- 21 23 25 27 29
Now I want to find if a given number is the sum of the numbers in a group and find the order number of that group.
I wrote the next code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int k;
scanf("%d", &k);
int x = 1;
while( x * x * x < k )
x++;
if( x * x * x != k )
x = 0;
printf("%d", x);
return 0;
}
Then I tried to change the while
loop to the next one:
while( x * x * x++ < k )
;
The program is not working and I get the next warning in codeblocks
:
operation on 'x' may be undefined
Why does it is not working?