Write a c++ program to display numbers from 1 to infinite by using for loop .

 


/* Write a c++ program to display numbers  from 1 to infinite by using for loop  */


#include <iostream>

using namespace std ;

int main()

{  

    int i, n ;

/* note : for making infinite loop ,there must be  such a condition which never be wrong  ex : 2>1 */

for(i= 1; 2>1 ; i++) // 2>1 always true 

  {  cout<< i <<"  ,  "; }

   return 0;

}


output 

1, 2  ,3, 4 ,5,..........................infinite   more exercise



Comments

Popular posts from this blog

Write the program to determine the maximum possible way to reach the end from starting in game board.

Write the program to arrange the n queen(queen of chessboard) in n*n matrix such that they can not ATTACK TO eachother.

DNF sorting ( 0s , 1s , 2s, sorting )