- Practice
- C++
- Introduction
- For Loop
- Discussions

# For Loop

# For Loop

jvinniec + 146 comments Ok, this took me the better part of an hour to figure out what they are asking in this question. Basically, the idea is you are given two numbers 'a' and 'b' such that a<=b. You then need to test every number from a to b and output either the text version of the variable (if number <=9) or whether the value is even or odd (if number > 9).

So basically when the inputs are 8,11 you need to test every integer from 8 to 11, so you need to test 8,9,10,& 11. This leads to the output specified in the "Sample Output" of "eight, nine, even, odd". Hopefully this helps someone out.

HMansolf + 5 comments Thank you. This really clarified things. Rewrote and got the code running in about 30 seconds after reading this.

Abhi1428 + 2 comments Thanx,it really helped..

cs15m059 + 1 comment thanks,it really Helped more

menet_ludo + 1 comment Thanx, it tooks me also a little bit of time before understanding what was the purpose of this exercice. It's not clear.

16131a05e3cse3 + 1 comment thank you,its been helpful

tmatsena + 1 comment hey guys mine runs, but when i submit the code it fails 3 test cases. anybody know how i can solve that?

yashpalsinghdeo1 + 0 comments here is solution of problem

**For loop**in C++ programming https://solution.programmingoneonone.com/2020/06/hackerrank-for-loop-solution-c-plus-plus.html

coder_aky + 20 comments # Mine one...

#include<bits/stdc++.h> using namespace std; int main() { int a,b; string c[]={"","one","two","three","four","five","six","seven","eight","nine"}; cin>>a>>b; for(int i=a;i<=b;i++) cout<<((i<=9)?c[i]:((i%2==0)?"even":"odd"))<<endl; }

000whiterose + 1 comment nice optimization, well precise.

pranjalparmar201 + 1 comment Great Job. Makes me feel like an idiot.

rhalababneh19 + 0 comments hahahah here too

siddhisoni_4 + 3 comments what is string c[]?

sahilm22 + 1 comment it is an string array. basically he took array and store string values according to index and retrive particular values by c[i] i.e by index. e.x c[4] gives you "four".

kumarabhinav1910 + 0 comments [deleted]

somya12240 + 0 comments [deleted]FVXT1 + 0 comments It's an array of strings with a unspecified size of the array.

adityashinde_041 + 0 comments Nice Shot!!!

saraswatjaishre1 + 0 comments very precise ....really impresive!

Im_a_rahman + 0 comments very good....

syed_irti + 0 comments I loved your logic, how nicely you have used the ternary operator... can it be used just to evaluate 2 conditions or more?

edreisipalay90 + 1 comment How was this able to allow to print EVEN and ODD after? Shouldn't after every loop it will ouput even or odd? I don't get it please help

syed_irti + 0 comments whatever will be the result, based on the output it will then compare that if the modulus is 0 so it will print even and if not equals 0 it will print the odd, hope this helps

ranapreet1999 + 0 comments clean

kushal14822 + 0 comments great

sakudacastro + 0 comments i do same logic xD

kajal_teetwal741 + 0 comments yahh ! its work.

aniketsaini25201 + 0 comments Well done!!

shrivastav4praty + 0 comments bhai such main ....bohot help full ho app

impratikk47 + 0 comments Greatt logic..!

tuptusstokrotka + 0 comments Ternary operator is my favourite :) Nice job!

gaurangvishnoi_1 + 0 comments brother can you please tell me how can I develop skills in coding..??

tejirid_aror + 0 comments what does a question mark mean in c++?

georgejohnson561 + 0 comments ah a string, feel dumb for using an entire switch statement for even number

ghostrider2 + 0 comments [deleted]mrhmamun + 0 comments Proper optimized, though I tried to make more lines.

CHODHARY + 10 comments # include

# include

using namespace std; int main() { int a,b; cin>>a>>b; for(a;a<=b;a++) {

if(a<=9) { if(a==8) cout<<"eight\n"; else if(a==9) cout<<"nine\n"; else if(a==7) cout<<"seven\n"; else if(a==6) cout<<"six\n"; else if(a==5) cout<<"five\n"; else if(a==4) cout<<"four\n"; else if(a==3) cout<<"three\n"; else if(a==2) cout<<"two\n"; else if(a==1) cout<<"one\n"; } else {`if(a%2==0) cout<<"even\n"; else cout<<"odd\n"; }`

} return 0; }

liordah01 + 4 comments its easier and better looking to use a switch statement: switch (count){ case 1: cout << "one" << endl; break; case 2: cout << "two" << endl; break; case 3: cout << "three" << endl; break; case 4: cout << "four" << endl; break; case 5: cout << "five" << endl; break; case 6: cout << "six" << endl; break; case 7: cout << "seven" << endl; break; case 8: cout << "eight" << endl; break; case 9: cout << "nine" << endl; break; default: if (count%2 == 0) cout << "even" << endl; else cout << "odd" << endl;

tpirramba + 0 comments exactly...but here the quesion is realted to loop so we should ans according to the question.

Tejas1996 + 1 comment but the questionnis looking for the numbers(in words) in order. so if you use break statement they wont outcome in order.

sidhudog2000 + 0 comments [deleted]

shuklarituraj9 + 45 comments This is my code

#include <iostream> #include <cstdio> using namespace std; int main() { int i,c,b; string a[11]={"even","odd","one","two","three","four","five","six","seven","eight","nine"}; cin>>c>>b; for(i=c;i<=b;i++) { if((i>9) && (i%2==0)) cout<<a[0]<<endl; else if((i>9) && (i%2!=0)) cout<<a[1]<<endl; else cout<<a[i+1]<<endl; } return 0; }

Headhunter1 + 0 comments nice bruh!

gajendra14695 + 2 comments in your code why are u useing the variable c,b;

sreehema98 + 0 comments b and c are variables to take 2 inputs.

shubham_maske24 + 0 comments actually its use for take input.

simranapril12 + 0 comments thanks man i was missing somnething out. my code is the same. arrays solved it in some lines of code!

avinashak558 + 1 comment What if b>c?? it wont work for b>c test case

shahjacobb + 1 comment Easy, just add a while loop and take input for C before B. While b is greater than c, do cin again until it's false.

ai_anton + 1 comment Or just swap them if(b>c)

nick_mehta2k19 + 0 comments or just use switch case.. code is here.. https://github.com/nick-mehta/hackerrank/blob/master/for%20loop.cpp

balakumaran428 + 0 comments that's great man, you have clarified my doubt. thanks a lot

420vijay47 + 0 comments thnkx

s1035111590 + 0 comments perfect....!

abhileshgupta74 + 0 comments nice code

souravrawat1999 + 0 comments thanks bro u cracked it

prakruthiks3 + 1 comment In an "If statement" what will happen if we directly give "even".Instead of giving through an array? Example: int i,b,c; string a[11]={"odd","one","two","three","four","five","six","seven","eight","nine"}; cin>>c>>b; for(i=c;i<=b;i++) { if((i>9) && (i%2==0))

cout<<"even"<aditi200076 + 0 comments i dont understand this code.From where variable c and b start.can u explain me?

Louiealdana + 0 comments sweet

Louiealdana + 0 comments sweet

mknekong + 1 comment the initializer for string didn't work out with me

jack882 + 0 comments worked for me. https://freeunusedeshop.codes/

Aminson_Jets + 0 comments Nice work!

Afzar + 0 comments Nice

blackwxf + 0 comments [deleted]Schick93 + 4 comments A simplified way

#include <iostream> #include <cstdio> using namespace std; int main() { int a, b; cin >> a; cin >> b; string num[9] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; for(int n=a; n<=b;n++) { if(n<=9) cout << num[n-1] << endl; else if(n%2==0) cout << "even\n"; else cout << "odd\n"; } return 0; }

sindhuja_22 + 1 comment right code but one condition is missing.. after the first else give another "if" which is n>9...so that it gives the required output....

nick_mehta2k19 + 0 comments use swich case like this https://github.com/nick-mehta/hackerrank/blob/master/for%20loop.cpp

tomarshabh2199 + 0 comments very very goog bro!

shamikh2000 + 2 comments Why do we use num[n-1], likw why do we use n-1 and why not n?

princeprabhat191 + 0 comments [deleted]rtr7018 + 0 comments because array index starting from 0 and to print one we must have to print 0th elements thats it.

princeprabhat191 + 0 comments but where did you declare the variable 'n' and ''sum''?

aakashditya + 1 comment thank u so much.

jack882 + 0 comments [deleted]

pandamanasranja1 + 0 comments Great job

yashco6112 + 0 comments nice code bro

bob_perry + 0 comments [deleted]bob_perry + 1 comment Very slight improvement to your if-then-else:

`if (i > 9) cout << a[i % 2] << endl; else cout << a[i + 1] << endl;`

singhrupesh4322 + 0 comments this is simple logic

parvej_mosharaf + 0 comments [deleted]eng22mohamed10g1 + 0 comments thanks

surabhiias15 + 0 comments cool

369jassi + 0 comments most effective and presicely written

nidhisethi88 + 0 comments that's amazing :D

zameerhussain + 0 comments good idea bro

Amardeep338 + 1 comment but we have to print a also but your code starts printing next to a??? eg if a=7 then your code starts printing eight nine and so on

rtr7018 + 0 comments read question carefully we have to print each interval between a and b

RA1811003010797 + 0 comments great

ali_tariq125 + 0 comments [deleted]luis_rodrigo_hi1 + 0 comments Genius

sarthakv + 0 comments amazing algorithm use bruh! I was making this code so long.

vishalraj97084 + 0 comments awsome brother....

bbest12g + 0 comments not clicking in my head why the else statement works. I thought the else block executes if the two previous conditions are both false no? I would have thought the cout << a[i+1] would be apart of the other two code blocks.

juanky006 + 0 comments Why do you add the c and b?

sagargope113 + 1 comment why are your output giving only : even odd eight nine

tell me please.nick_mehta2k19 + 0 comments

nitish3616 + 0 comments thanks bro !

tomarshabh2199 + 0 comments nice approach bro!

snyoupane1s + 0 comments can anyone explain me this code please

BeardedOwl + 0 comments Nice

lsingh_be19 + 0 comments bahut sahi bnaya bro

chaitanya_22 + 0 comments great..!!

shivam1998mittal + 0 comments nice implementation :0

rtr7018 + 0 comments very good solution bro actully i am trying it without adding even and odd in the array

vvyy346 + 0 comments you have to remove the break statements otherwise you will have only one output ( of the matching case ). if you skip the break statements you will get all the outputs after your matching statement

danielgcwik + 2 comments thanks this works in c++. I get problems with cin undclared if I used C

pradyumnachak98 + 0 comments same here

srikanthhubli + 0 comments c dosnt hace cin u should use scanf

bergart11 + 11 comments Great code, I like it.

Here is mine:

#include <iostream> #include <cstdio> using namespace std; int main() { // Complete the code. int a,b; int n=0; string intMap[9]= {"one", "two","three","four","five","six","seven","eight","nine"}; cin>>a>>b; if ((a<=9)&&(b<=9)){ for(n=a;n<=b;n++){ cout << intMap[n-1]<<endl; } } else if ((a<=9)&&(b>9)){ for(n=a;n<=9;n++){ cout<<intMap[n-1]<<endl; } for(n=10;n<=b;n++){ if (n%2==0){ cout<<"even"<<endl; } else { cout<<"odd"<<endl; } } } else { for(n=a;n<=b;n++){ if (n%2==0){ cout<<"even"<<endl; } else { cout<<"odd"<<endl; } } } return 0; }

piyushp0541 + 4 comments for(n=10;n<=b;n++){

if (n%2==0){ cout<<"even"<`what these lines are performing can anyone explain please ....`

Vexify + 2 comments //Compares the values of a, b with 9 and if values <= 9 then //Prints all values from 'a' uptill 'b' in string format if ((a<=9)&&(b<=9)){ for(n=a;n<=b;n++){ cout << intMap[n-1]<<endl; } } //Compares the values of a, b with 9 //And if the value of a <= 9 and value of b > 9 then.... else if ((a<=9)&&(b>9)){ //Prints all the values starting from 'a' uptill 9 //in string format and then.... for(n=a;n<=9;n++){ cout<<intMap[n-1]<<endl; } //For values which are greater than 9 and <= to 'b' //Prints 'even' or 'odd' for them for(n=10;n<=b;n++){ if (n%2==0){ cout<<"even"<<endl; } else { cout<<"odd"<<endl; } } } Hope that helps.

samarthchadda_i1 + 0 comments why you have used intmap[n-1]

fatursetiawan80 + 0 comments thank you so much...

sanjay_kanakkot + 0 comments [deleted]sanjay_kanakkot + 0 comments for(n=10;n<=b;n++) checking the value of n is less than b if(n%2==0) suppose the value of n you given is 10 if statement will find the remainder by using the modulus % that is n%2 10%2 just divide the reminder will always be zero which means if its divisible by 2 it is even number..

klausskent17 + 0 comments you have a for loop and it start counting from 10 , after check the condition if n is inferior or egal to b , when it is true it increment the value of n ... if n%2 == 0 , means if n is divisible by 2 , he will display even I hope it helps you :-)

eshank_tiwari + 0 comments [deleted]abhisheksud96 + 0 comments what is the use of String intMap[]

vasu71051 + 1 comment can u please explain the string type in C++ .I searched it over net but didn't got the satisfying result. According to me String is an array of char but you used it as a predefined data-type.how?

singla_skanika + 0 comments are you askin about its library file? If that is true,

# include

talalawaiskhan + 0 comments Love your code but arrays havent been introduced here yet! so why did u use it? Cant it be done without arrays?

V0dK6 + 0 comments After your "else if", your "else" statement can be skipped. It will pass all tests cases without. Just saying... Your code is great by the way and pass all tests cases anyway ;-)

shuklarituraj9 + 3 comments Much simple, try this.

#include <iostream> #include <cstdio> using namespace std; int main() { int i,c,b; string a[11]={"even","odd","one","two","three","four","five","six","seven","eight","nine"}; cin>>c>>b; for(i=c;i<=b;i++) { if((i>9) && (i%2==0)) cout<<a[0]<<endl; else if((i>9) && (i%2!=0)) cout<<a[1]<<endl; else cout<<a[i+1]<<endl; } return 0; }

annufranci + 0 comments [deleted]AuCcH + 0 comments it helped

aamirsohail_as75 + 0 comments sir, can you explain in easy way, please

codertoaster + 1 comment Unnecessarily making it so long and unreadable.

string words[]={"one","two","three","four","five","six","seven","eight","nine"}; for(int n=a;n<=b;n++) { if(n>9) if(n%2==0) printf("even\n"); else printf("odd\n"); else printf("%s\n",words[n-1].c_str()); }

shuklarituraj9 + 0 comments I think it is better than writing multiple "if-else" and one who can code can read it without any trouble.

vipinarmy100 + 0 comments what for the values when a and b both are greater than 9

Prodyte + 0 comments pretty long one.

sprudra2001 + 0 comments exactly wwhat i did nut there are slightly better codes available we wont need those many if else and for loops inside.

cdabbott + 1 comment This works but is not correct, it will not work if the numbers greater than 9 are fewer than the numbers that are les than or equal to 9.

for example a=3 b=5 out put would be; three four five

no odds or evens

jack882 + 0 comments thank you http://freexboxlivecodes2019.com/

rvinothkanna + 0 comments Thanks a lot

keh_mario + 0 comments Don't waste your time typing all that out

int main() { // Complete the code. int a, b; cin>>a>>b; string num[9] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; for(int i=a; i<=b ;i++) { if(i<=9) cout<<""<

cjschuller01 + 0 comments you could also use an arry insted on usong all these lines

ushrivastava206 + 0 comments tu chutia hai sale bahenchod

mdhayatuddin + 0 comments thanks

kiiwy112 + 0 comments You do

`if (a % 2 == 0)`

I disagree in 2 ways: 1)`a`

isn't a good variable name. 2) modulo is slower than`&`

(aka`bitand`

)`if (number & 1 != 0)`

number is odd. It's binary representation ends in 1. Of course this, afaik, only works with 2's complement numbers (for negative nums) which is only standard in every single cpu available in the last 40 years.Who knowsâ€¦ Maybe IBM will release another sign magnitude cpu and when it doesn't sell you can keep on using my technique. ._.

rattikarn_dudley + 0 comments Thanks! this helped a lot.

michellerodri247 + 0 comments There are a of loops that is useful to handle the coding Restart Print Spooler Service . The loops best for reducing the length of the codes and helping to understand the program better. For loops are good for understanding and for providing an exact limit.

coder_aky + 2 comments # Mine one...

#include<bits/stdc++.h> using namespace std; int main() { int a,b; string c[]={"","one","two","three","four","five","six","seven","eight","nine"}; cin>>a>>b; for(int i=a;i<=b;i++) cout<<((i<=9)?c[i]:((i%2==0)?"even":"odd"))<<endl; }

singhrupesh4322 + 0 comments thts pretty easy

tusharranjanjha2 + 0 comments [deleted]

Adil + 0 comments Thank you!

akash4u + 0 comments thank you...

redpix_ + 0 comments [deleted]alextaylor + 1 comment I could not make sense of the original question as written. Thank you.

bigdan4712 + 0 comments That's because the author made the problem over-complicated. This is supposed to be an introductroy style problem and he went way over the mark. I was able to read the problem because I have a minor in math and have studied number and set theory in discrete mathematics.

hugo_lin + 0 comments It's helpful, thank u

OrionH + 0 comments this definitely helped. cheers man

NapdaN + 0 comments Thanks !!!

AbhishekKrishna + 0 comments Thank you, helped me understand the problem. The question needs to be edited to make it more clear.

shemul + 0 comments [deleted]souravsam + 0 comments definitely it helped a lot :) tnx

geo_hackerrank + 0 comments thank you .it helps me a lot

furiacs + 0 comments Thanks man!

trailblazerr + 0 comments gr8

ajit4all21 + 3 comments //wth is wrong with this code?

# include

using namespace std; int main() { int a,b; cin>>a>>b;

`for(a;a<=b;a++) { if(a<=9) { if(a==8) cout<<"eight\n"; else if(a==9) cout<<"nine\n"; } else { if(a%2==0) cout<<"even\n"; else cout<<"odd\n"; } } return 0;`

}

xsmgxbrayley + 2 comments Try changing "else if(a==9)" to just an else statement because if/else chains always need to end with an else statement to default to if no other case is true.

FiyinDaniel + 0 comments your code would only work if one of the numbers entered was eight. you should include all numbers less than 9.

drkato + 0 comments That is not true. It is perfectly acceptable to have an if/if else with no last else case if your intention is to have a situation where no statement executes if your specific conditions are not met. It is analogous to writing...

else ;

maximshen + 0 comments [deleted]shuklarituraj9 + 0 comments Use this code

#include <iostream> #include <cstdio> using namespace std; int main() { int i,c,b; string a[11]={"even","odd","one","two","three","four","five","six","seven","eight","nine"}; cin>>c>>b; for(i=c;i<=b;i++) { if((i>9) && (i%2==0)) cout<<a[0]<<endl; else if((i>9) && (i%2!=0)) cout<<a[1]<<endl; else cout<<a[i+1]<<endl; } return 0; }

Khushboo_Watwani + 1 comment Thank you so much for explaining this question... :)

akhii + 10 comments int a,b,i; cin>>a; cin>>b; for(i=a;i<=b;i++) { switch(i) { case 1: cout<<"one \n";break; case 2: cout<<"two \n";break; case 3: cout<<"three \n";break; case 4: cout<<"four \n";break; case 5: cout<<"five \n";break; case 6: cout<<"six \n";break; case 7: cout<<"seven \n";break; case 8: cout<<"eight \n";break; case 9: cout<<"nine \n";break; } } for(i=10;i<=b;i++) { if((i%2)==0) cout<<"even \n"; else cout<<"odd \n"; }

decoder_ + 1 comment Ain't this wrong?

akhii + 1 comment no its correct

decoder_ + 1 comment what if the value I give is a=8 and b=5?

akhii + 1 comment You will be given two positive integers, a and b (a<=b), separated by a newline. read the question first .....AH

decoder_ + 1 comment calm down okay! It was just a mistake. Sorry that I asked you.

drkato + 1 comment Good practice would be to not assume such things, so your intuition is spot on. A simple check at the beginning of the function hurts nothing, as so...

int a, b; cin >> a; cin >> b; if((b - a) < 0) return 0; //or whatever other error handling is needed

RA1511008010245 + 0 comments you are right .

shahashish991 + 2 comments [deleted]akhii + 1 comment its coreect u mother fucker

baby_hacker + 0 comments hahahaha

andriesuaktiwa + 1 comment lmao the comment and reply.. hahaha you guys, made my day

b6032682 + 0 comments very funny stuff

deekshith565 + 0 comments [deleted]shajol484 + 0 comments thanks

samplenhold + 0 comments Pretty poor solution. Unnecessary use of two for loops. You can do it in one for loop. The code would be easier to read if it was written using one loop and in the loop had an initial if/else structure that determines if the current number in the iteration is less than or equal to 9. If the count is less than 10, you have if statements that print the english word out, and if the count is greater than or equal to 10, then you do modulo to determine even or odd.

alice_ferrazzi + 0 comments using a double for loop is not necessary

bartlomiejpopek + 0 comments This is wrong. When I Try imput more then 10 eg. 23 and 25 I get to many even and odds.

shuklarituraj9 + 1 comment Try this

haberpeter + 0 comments I see this kind of solution in many cases. But in fact this is wrong. This works only in case the first input is less than the second one. If the test case would be 12 and 11 then this failed the test case because the code does not enter into the for loop, because c is greater than b.

vvyy346 + 0 comments bro just skill the break statement in switch case and the you will be needing only second loop

Meenachinmay + 1 comment but what you will do when both numbers are between 1 and 9...because two given value may be anything,,,may be both are greater than 9 than what?

Khushboo_Watwani + 3 comments if two given numbers are between 1 and 9...

like: 2 4

then output: two three four

and if two numbers are greater than 9...

like: 20 23

then output: even odd even

Meenachinmay + 0 comments try this with some standard input samples,,,,it may be more comfortable,,,,MAY BE

mukulpahwa504 + 0 comments for 20 23 output: even odd even odd

bindass844 + 0 comments yess

GrimNight + 1 comment Thx A lot!!!!

Meenachinmay + 0 comments not at all.,,,just remember me in ur wish...:)

Tushar_Mehr + 0 comments You the real MVP!

rushabhajain4444 + 0 comments Thanks..

dynamicsahithi + 0 comments thank you so much

dulini88 + 0 comments Thank you very much for help understanding the original question.

SEBPort0 + 0 comments Thank you!

givonz + 0 comments i have found that a significant number of problems, need a LOT better definition. the sample/input confuses the normal interpretation of the question.

givonz + 0 comments i have found that a significant number of problems, need a LOT better definition. the sample/input confuses the normal interpretation of the question.

givonz + 0 comments now i understand why this doo hickey problem was asked before having discussed arrays and; why it needs a loop!!!!!

jingren1021 + 0 comments thank you very much

sprajosh + 0 comments thank you... not helps someone...its helping a lot of people...

iamrizubiswas + 0 comments Very helpful! saved a lot of time ,Thanks :)

jitender1712 + 0 comments Thanks , earlier the expected output looks bizzare to me. But now , I got the problem.

xgasko + 0 comments Thanks

hacktik + 1 comment i m still a bit confused... if (no<=9) the text version of it must be got so if input is 8.. we got to get eight.. thats alrite but after that the condition goes like if(no>9) then print even or odd respective of the no.. so for input 11 we must print it as odd only right? the output must be like "eight odd" only no, how does the ouput cums like "eight nine, even,odd" ???

xgasko + 1 comment Yes, if the number is less or equal than 9, then print the English representation of it. If it's bigger, you should print "even" or "odd", depending on the number. Now, your input contains two numbers. You have to print every number that is between those numbers, including those two numbers. For example, input is 8 and 11 - you print:

eight

nine

even

odd

If the input is 2 and 6, you should print:

two

three

four

five

six

hacktik + 1 comment thanks a lot for ur kind response... got figured out in a very clear way !!

alex_casinority1 + 0 comments Modern schools and colleges donâ€™t pay enough attention to soft skills as well. For example rapidessay, the types of assignments where students have to work together are excellent for the development of cooperation skills, while the only thing the modern students can learn from theoretical papers and essays is how to type faster.

Abul_Kalam + 0 comments Yup!... It really works.......

ascotan + 0 comments I'm glad i looked at the discussion here. It took me all of 15 seconds to fix my code after reading this. The question is clear as mud.

EtsRk + 0 comments Thanks..it helps me a lot.

Sivakumarramar + 0 comments thnx a lot

ricargu2010 + 0 comments this assignment was not clear at all, what they should say is print from the first given number to 9 in the form of "one", "two" ... "nine", and "even" , "odd", "even", to the second given number.

smokhele48 + 0 comments Question is not that clear. This got me in the right track. :)

menglish2451 + 0 comments Great explanation of the problem, I wasn't understanding the input until now.

rheasanjan + 0 comments Thank you so much!!

Parashuram_Joshi + 0 comments Thanks, it helped me

jwc_it_studio + 0 comments Thanks, I didn't understand what I was messing up till I read your explination.

surajsetty_sbi + 0 comments thanq soo much

ojas_k30 + 0 comments thanks

h754548560 + 0 comments Thank you very much, It's help a lot.

kashif_i + 0 comments This really

**helped**in explanation of the orignal question.m_patterson + 0 comments Thanks. It's a really badly worded question. It's very easy when explained clearly as you've done.

muhammadburhanz1 + 0 comments someone please told them to correct the question

vatsal09 + 0 comments Thanks for this.

naiktanvi + 0 comments Thanks! The comment really helped.

laurap + 0 comments Oh my gosh thank you!

stayx + 0 comments thanks a lot

ssanck + 0 comments Thank you !

fireash + 0 comments Horribly worded problem

caitenkhongbitr1 + 0 comments Thank you a lot. It really helpful.

zwlady253 + 0 comments Thanks . you saved me .

Engineer_x + 0 comments really helpful....thanks bro.

maheshvangala191 + 0 comments Thank you jvinniec Your suggestion helped me to solve this problem thank you very much

kai_abhik + 0 comments Thanks, I was really annoyed.

ABInfinity + 0 comments thanks bro that was really helpful..

vishalshukla044 + 0 comments dont know what to say just one word thnxs a lot

snmahajan30 + 0 comments yeah it really helped.

naveensurya3010 + 0 comments thanks bro

naveensurya3010 + 0 comments thanks bro

paraschopra2000 + 0 comments Helped alot, Thanks.

chancs88 + 0 comments Thank you. That helps a lot.

samarthchadda_i1 + 0 comments thats good but not great we can have other simple alternatives

Sarques + 0 comments thanks so much, i was just lost in the problem. I was just don't getting the question.

vishariaraj + 0 comments Thank you so much. You clarified the question. :)

shreyanshgoyal90 + 0 comments you actually saves my time thanks....

ketansuthar899 + 0 comments Thank you.

zppr12 + 0 comments Thanks a lot sir

Shi_vam11 + 0 comments it helped a lot man.Thank you

rschoudhary1999 + 0 comments Thanks, couldn't figure it out till I saw your comment. Really appreciate it. Helps us beginners alot.

alexbryant + 0 comments Wow, the instructions don't say that at all.

jose_lsandra + 0 comments Thank you so much. I was sitting with this for 2 hours and never understood what this was about. Thanks.

15JG1A0490 + 0 comments thanku....it really helped in understanding what they asked for!!

yvohu2002 + 0 comments Haha thanks!, this question was very poorly written.

imtherealtoast + 0 comments Yes it does! The way these questions are put is often more complex than the code needed lol.

mkathpal09 + 0 comments thankyou.

mohitkumar200131 + 0 comments thank you now i got it

olavo_o_neto + 0 comments Thanks, I was not understanding the question

ramyaasrih + 0 comments tq so much,, this cleared all my doubts

haniyeh_ghassami + 0 comments really thanks.

vengelke + 0 comments Thank you! It really helped.

strange_Tiwari1 + 0 comments [deleted]Pradyumn05 + 0 comments thanks bud

teoh_xu_yang + 0 comments thx

Danishta + 0 comments Thank you, now I see what they wanted.

satyaprakashnig1 + 0 comments thank you so much. I was confused, it really really helped.

DodgersFan805 + 0 comments Thank you sir! You are the man! Was getting bothered until I noticed I misunderstood what was meant in the problem. Thank you!!!!

cajay550 + 0 comments Thnk you it really helped

victoribasco18 + 0 comments Thanks a bunch! Strangely worded questions are ... frustrating

jak_pettigrew + 0 comments Thank you so much! I feel as though this test could have been written a bit clearer.

parthduggal777 + 0 comments thnks really helped!!!

verma_rajesh6615 + 0 comments Yeah,this is very helpfull to understand the problem.

bhavanidinesh_b1 + 0 comments it is very helpful

sushmabegumshai1 + 0 comments tqsm

lolnoobhax + 0 comments Finally this is making sense, couldn't figure out why it would need a for loop but in that case it does make sense. thank you!

Aminson_Jets + 0 comments Thank you!

gregorgolen + 0 comments Thanks, I really couldn't get what they are talking about here.

namantamboli11 + 0 comments Thank you so much.

pratyush3105 + 0 comments thanx bro...ur clarification really helped..

nikhilbagdi + 0 comments thank you so much.

lynxdom + 0 comments That was a big help!

lefa_ml99 + 0 comments thank you man and one other thing the user must input the bounds for a and b, and they didnt mention that the problem, so they expect you to know.

yashgowda7 + 0 comments thanks man! i scratched my head for a while to analyse the given output.

sakshee1120 + 0 comments Thanks a lot!

surabhiias15 + 0 comments yes...thank you very much

369jassi + 0 comments It was tough to understand what were they asking about........ rest was easy

ross_anton + 0 comments thanks so much for your simplistic explinatation, i had no idea what they were asking and i felt so stupid.

Yash_Garg01 + 0 comments thx brother.

bharadwaj_sarth1 + 0 comments dude thanks this really helped all of us.the question was a little vague i guess

[deleted] + 0 comments I agree with you about the explanation of the exercise. Sometimes I don't understand what is the task and I lose time only for understand what I have to do.

olaf_a_minkowicz + 0 comments int main() {

`int i, j; cin>>i>>j; string words[11] = {"even", "one", "two", "three", "four", "five", "six","seven","eight","nine","odd"}; for(int q = i; q<=j;q++){ cout<<((q <= 9) ? words[q] : ((q%2) ? words[10] : words[0]))<<endl; } return 0;`

}

ChathuraJW + 0 comments Thank you really helpfull your defination.

[deleted] + 0 comments Thank you, this clarified everyhthing.

ards1991 + 0 comments Thanks a lot.. This should have been the question. :)

vemali_adarsh + 0 comments Thank you

aashutosh213 + 0 comments that really helped me thanks dude'

michaelcharlesb1 + 0 comments Seriously thank you for explaining that

chiraudeshnew + 0 comments thanks

saisowjava + 0 comments thankyou

Rich_94 + 0 comments [deleted]harshitmamgai11 + 0 comments it really helped me , i was just stuck and then i got your comment and you saved me .. thanks man

janimanvendra + 0 comments thank a lot man

simonakpoveso + 0 comments Thanks. This saved me a lot of headache

sahilm22 + 0 comments Appreciated :)

Mikaz3 + 0 comments This is rly hard for me to understand -.- Thanks yo

priyadeveloper21 + 1 comment Thank you so much. You clarified the question. :)

koushik12543 + 0 comments Nice conversation gone thanks for the Wonderful Questions Given Above. https://www.slajobs.com/python-training-institute-in-chennai/

pingaleomkar7 + 0 comments thenks a lot.

edreisipalay90 + 0 comments i don't get why there is only two ODD and EVEN

aashalkamdar + 0 comments thanks, i could not understand the problem only at first.

gurpreet_singh_2 + 0 comments thanks alot brother

robinNcode + 0 comments Thank you Very much .

anushkajadhav138 + 0 comments thank you. this really helped me :)

priyanshapriety + 0 comments

Sort 816 Discussions, By:

Please Login in order to post a comment