C++ tutorial, C++ programs, C++ Exercises, C++ Example Programs

Friday, December 6, 2013

Program For Loop Display 1 To n Numbers

/*
Write a C++ Program to display All numbers from
1 to n (the entered positive number)by FOR Loop

For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com

and For Good Notes
Visit   Www.ForFreeEducation.Blogspot.Com
*/


Program For Loop Display 1 To n Numbers, C Plus Plus program to display 1 to n numbers
#include<iostream.h>

#include<conio.h>

void main()
{

  clrscr();

  int number, counter;

  cout<<"\n Enter a positive number = ";

  cin>>number;

  cout<<"\n\n ----------- Results ------------";

  cout<<"\n\n Display All Numbers between \n 1 to n(entered positive number)\n by For Loop ";

  for (counter = 1; counter <= number; counter++)
           cout<<"\n \t"<<counter;

  getch();

}
Share:

0 comments:

Post a Comment

We Love To Hear From You!

EasyCPPprogramming.blogspotcom

Blog Archive

Labels