Write a program to display all the even numbers and odd numbers between 1 and 100 using for loop.

Write a program to display all the even numbers and odd numbers between 1 and 100 using for loop. 

 # include <iostream>
using namespace std;
int main(){
       for (int a = 2; a <= 100;a=a+2){
              cout << a << endl;

       }
       for (int b = 1; b <= 100; b = b + 2){
              cout << b << endl;
       }

       system("pause");
       return 0;
}

Comments