1067 Odd Numbers

SemiColon
By -
0
URI Online Judge | 1067

Odd Numbers

Read an integer value (1 <= <= 1000).  Then print the odd numbers from 1 to X, each one in a line, including Xif is the case.

Input

The input will be an integer value.

Output

Print all odd values between 1 and X, including if is the case.
Input SampleOutput Sample
81
3
5
7

Solution:

#include<stdio.h>

int main() {
    int X;
    scanf("%d", &X);
    printf("1\n");
    for (int i = 1; i < X-1; i+=2) {
       int oddNumber = i + 2;
        printf("%d\n", oddNumber);
    }
  return 0;
}


Tags:

Post a Comment

0Comments

Post a Comment (0)