this is the code ..but it is not displaying the first and the last number that came from the user.
anyone can help me with this small problem??
cout<<"Enter the First digit:";
cout<<"Enter the Last digit:";
cout<<"The Odd numbers/digits between "<<f<<" and "<<l<<" Are: "<<endl;
cout << "And Even numbers/digits between "<<f1<<" and "<<l<<" are:"<<endl;
Enter the first number:1
Enter the Last number:10
The Odd numbers between 1 and 10 are:
And the even number between 1 and 10 are:
Firstly, please use code tags (there's still time to edit your post and put them in).
For your for loops, you are incrementing your values in your initialization step (and thereby skipping over the first value) and you were losing your last (if you want it) by having a termination condition that was < instead of <=: for ([COLOR="Red"]f++[/COLOR];f<l;f++) in both cases
Use a different variable if you can and have for (int index = f;index <=l;index++) (for example) In that same vein don't use 1 letter variable names, there's no savings there and there is a decrease in readability.