Title Address: http://acm.nyist.net/JudgeOnline/problem.php?pid=11 Description
There is an integer even n (2<= n <=10000), you have to do is: first 1 to N of all the odd numbers from small to large output, and then all the even from small to large output. Input
The first line has an integer I (2<=i<30) that indicates that I have a set of test data;
Each group has an integral type even n. Output
The first line outputs all the odd numbers
The second line outputs all the even sample inputs
2
10
14
Sample output
1 3 5) 7 9
2 4 6) 8 10
1 3 5 7 9 11 13
2 4 6 8 10 12 14 Code:
#include <stdio.h>
int main ()
{
int readlen = 0;
scanf ("%d", &readlen);
GetChar ();
While (Readlen > 0)
{
int num =-1;
scanf ("%d", &num);
GetChar ();
if (num% 2 = 0)
continue;
int i=1;
For (; i<num;i+=2)
{
printf ("%d", I);
}
printf ("\ n");
i=2;
For (; i<=num;i+=2)
{
printf ("%d", I);
}
printf ("\ n");
--readlen;
}
return 0;
}
03-language introduction -03-odd even separation