** I wanted to print each integer (n) between b and c such that if n>9 else statement executes and prints out each integers in the form of even or odd.The if statements executes if the following condition of the variables of c and b are true.So there is no problem if i input c and b both <9.
**
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int b;
int c;
string x[9] = {"one","two","three","four","five","six","seven","eight","nine"};
cin >> c;
cin >> b;
for (int r=0 ; c <= b ; c+1) {
c=c+1+r;
if (1<= c <= 9) {
cout << x[c-2] << endl;
} else {
if (c%2 != 0) {
cout << "odd" << endl;
} else {
cout << "even" << endl;
}
}
c;
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire