Wednesday, December 2, 2015

Uri problem 1067 solve

Problem :

Odd Numbers

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read an integer value (1 <= <= 1000).  Then print the odd numbers from 1 to X, each one in a line, including X if is the case.

Input

The input will be an integer value.

Output

Print al odd values between 1 and X, including if is the case.
Sample InputSample Output
81
3
5
7

Solution:


#include<stdio.h>
 
int main()
{
    int X ,i ;
    scanf("%d",&X);
    for(i = 1; i <= X; i++){
        if(i % 2 != 0)
            printf("%d\n",i);
    }
 
    return 0;
}

No comments:

Post a Comment