what will be the program in C++ using FOR LOOP??

#include <iostream>

using namespace std;

int main()
{
int odd;
int even;
for(odd = 1; odd<=99; odd = odd + 2)

cout<<"the odd number is "<<odd<<endl;







for(even = 2; even<=100; even = even + 2)
cout<<"the even numbers is "<<even<<endl;


}
AND I WANT OUTPUT LIKE THIS

ODDnumbers EVEN NUMBERS
1 2
3 4
5 6
7 8
9 10
Last edited on
could we see the code youve done so far?

btw , use modulo
As Lorence said show your code...

I recommend going here though for info on for loops:

http://www.cplusplus.com/doc/tutorial/control/

or here:

http://www.learncpp.com/cpp-tutorial/57-for-statements/
1
2
3
4
5
6
7
8
9
for (int i = 0; i <= 0; i++)
{
  cout << "odd even" << endl;
  cout << "1 2" << endl;
  cout << "3 4" << endl;
  cout << "5 6" << endl;
  cout << "7 8" << endl;
  cout << "9 10" << endl;
}
I lol'd.
As did I.
If you want more help, you'll need to give us more information about what you want your program to do. You can do anything you want with for loops. Follow the links that TheBadCoder gave you if you want to learn more about for loops.

If you have a specific question about a program you are working on, tell us what you are trying to do with the program and what you are having trouble with.
Topic archived. No new replies allowed.