Definition
In C++ for loop statement which allow code to be repeatedly executed mainly for loop is classified as an iteration statement .LEARN C++ IN SIMPLE MANNER BUY THIS BOOK
Coded by := Tinku Gupta
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
// variable declaration
int b,counter;
// Get input through Keyboard
cout<<"Enter the number:";
cin >>b;
// using for loop block
for(counter = 1; counter <=b; counter++)
{
cout << "execute" << counter << " time " << endl;
}
getch();
return 0;
}
OUTPUT
Enter the number:5 execute 1 time execute 2 time execute 3 time execute 4 time execute 5 time

Comments
Post a Comment