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??
#include <iostream.h>
#include <conio.h>
main()
{
int f,l,f1,l1;
clrscr();
cout<<"Enter the First digit:";
cin>>f;
cout<<"Enter the Last digit:";
cin>>l;
f1=f;
l1=l;
cout<<"The Odd numbers/digits between "<<f<<" and "<<l<<" Are: "<<endl;
for (f++;f<l;f++)
{
if ((f%2)!=0)
cout<<" "<<f<<endl;
}
cout << "And Even numbers/digits between "<<f1<<" and "<<l<<" are:"<<endl;
for (f1++;f1<l1;f1++)
{
if ((f1%2)==0)
cout<<" "<<f1<<endl;
}
getch();
}
the output:
Enter the first number:1
Enter the Last number:10
The Odd numbers between 1 and 10 are:
3
5
7
9
And the even number between 1 and 10 are:
2
4
6
8