[Solution] Six Odd Numbers - 1070 beecrowd |

beecrowd | 1070

[Solution] C++ : Six Odd Numbers

Timelimit: 1

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 Sample

8


Output Sample

9

11

13

15

17

19




[Solution] C++ : 

#include <bits/stdc++.h>
using namespace std;
int main(){

    int x;
    cin>>x;
    int c=1;
    for(int i=x; c<=6; i++){
        if(i%2!=0){
            cout<<i<<endl;
            c++;
        }
       
    }
    return 0;
}

Comments

Popular posts from this blog

Whiteboarding Interviews

Version Control with Git: A Beginner’s Guide

Callback function in JavaScript