URI - BEECROWD - BEE 1070 - Six Odd Numbers Solution in C,C++,Python

URI - BEECROWD - BEE 1070 - Six Odd Numbers Solution in C,C++,Python | URI Online Judge Solution 1070 - Six Odd Numbers

Read an integer value and print the 6 consecutive odd numbers from X, a value per line, including if it is the case.

Input

The input will be a positive integer value.

Output

The output will be a sequence of six odd numbers.

Input SampleOutput Sample

8

9
11
13
15
17
19

URI 1070 - Six Odd Numbers Solution in C,C++,Python | URI Online Judge Solution 1070 - Six Odd Numbers :

                                        Demonstration:

Any integer that cannot be divided exactly by 2 is an odd number.
Here we apply a range-based while loop which will run 6 times and checking the condition for six odd numbers are applied and printing these values. 
N.B: Don't copy paste the code as same. Just try to understand it and try yourself.

   URI - BEECROWD - BEE Problem 1070 Solution in C :   

   URI - BEECROWD - BEE Online Judge 1070 Solve  in C :                                      
#include <stdio.h>

int main()
{
    int n, i=0;
    scanf("%d", &n);
    while(i < 6){
        if(n%2!=0){
            printf("%d\n", n);
            i++;
        }   
        n++;
     }   
    return 0;
}

0 Response to URI - BEECROWD - BEE 1070 - Six Odd Numbers Solution in C,C++,Python

Post a Comment