Beecrowd-1070 Six Odd Numbers Solution
Six Odd Number
Read 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 | Output Sample |
8 | 9 11 13 15 17 19 |
Beecrowd 1070 Six Odd Numbers Solution in C
#include<stdio.h> int main() { int x,i; scanf("%d",&x); if(x%2==0)x++; for(i=0;i<6;i++){ printf("%d\n",x); x=x+2; } return 0; }
Solution in C++
#include<iostream> using namespaces std; int main() { int x; cin>>x; if(x%2==0)x++; for(int i=0;i<6;i++) { cout<<x<<endl; x=x+2; } return 0; }