[Solution] Six Odd Numbers - 1070 beecrowd |
beecrowd | 1070
[Solution] C++ : Six Odd Numbers
Timelimit: 1Read an integer value X and print the 6 consecutive odd numbers from X, a value per line, including X 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
Post a Comment