Posts

Showing posts with the label even-number

Program to print all the odd numbers till "n".

Image
  Program to print all the odd numbers till "n".

Program to print all the even numbers till "n".

  ap3c #include <iostream> using namespace std ; //Program to print all the even numbers till "n". int main (){     int n ;     cout << "Enter a number: " ;     cin >> n ;     cout << "All the even numbers till " << n << " are:" << endl ;     for ( int i = 1 ; i <= n ; i ++){         if ( i % 2 != 0 ){             continue ;         }         cout << i << endl ;     }     return 0 ; }