Skip to content

Commit 82ec115

Browse files
Create 3forloop.cpp
1 parent 2eabbf5 commit 82ec115

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

3forloop.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* Input Format
2+
3+
You will be given two positive integers, and (), separated by a newline.
4+
5+
Output Format
6+
7+
For each integer in the inclusive interval :
8+
9+
If , then print the English representation of it in lowercase. That is "one" for , "two" for , and so on.
10+
Else if and it is an even number, then print "even".
11+
Else if and it is an odd number, then print "odd".
12+
Note:
13+
14+
Sample Input
15+
16+
8
17+
11
18+
Sample Output
19+
20+
eight
21+
nine
22+
even
23+
odd */
24+
25+
#include <iostream>
26+
#include <cstdio>
27+
using namespace std;
28+
29+
int main() {
30+
// Complete the code.
31+
int a,b;
32+
cin>>a;
33+
cin>>b;
34+
int i;
35+
string k[10]={"zero","one","two","three","four","five","six","seven","eight","nine"};
36+
for(i=a;i<=b;i++){
37+
if(i<=9){
38+
cout<<k[i]<<endl;
39+
}
40+
else{
41+
if(i%2==0){
42+
cout<<"even";
43+
cout<<endl;
44+
}
45+
else{
46+
cout<<"odd";
47+
}
48+
}
49+
}
50+
return 0;
51+
}

0 commit comments

Comments
 (0)