Topic content:
Class for the first time, usually the teacher will let students in a row by height, and then 1, 2 count, shout to 1 of the students forward a step, so that the team becomes two columns. Suppose now a class has n students, and they have been ranked by height in a row, students by height from 1 to n number, you can tell me the last number of students standing in the first column?
Input format:
Enter a positive integer n to indicate the number of classes.
Output format:
In order to output all the students in the first column corresponding to the number, each of the two numbers separated by a space, the last number followed by no space.
Input Sample:
11
Sample output:
1 3 5 7 9 11
#include <stdio.h>int main () {int n;scanf ("%d", &n), int x=1;do{if (x%2 = = 1) {printf ("%d", x); if (n%2 = = 1 & & x<= n-2) {printf ("");} else if (n%2 = = 0 && x<= n-3) {printf ("");}} x + +;} while (x<=n); return 0;}
Onge C Language Introduction third week programming problem (revision) of "sub-queue"