Skip to main content

Simple For Loop Example Program In C++

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

Popular posts from this blog

Difference between px,dip,dp and sp in Android

Difference between px,dip,dp and sp in Android MEANING px   -> It stands for pixel and has a same meaning to the resolution of the screen density. it corresponds to the actual pixel in the screen. dip ->Dip and dip both are one and the same thing.It stands for density independent pixel.It is dependent on physical intensity pixel of screen. sp  It stands for scaled pixel. USAGE px It is used with the images to resize the image.used to fit the image to screen and change the size of the image.

Concatenation Of String

Concatenation Of String #include<iostream.h> #include<conio.h> #include<string.h> void main() { clrscr(); string str1="programming"; string str2="hub"; string str3; int len; str3=str1; cout<<str3; str3=str1+str2; cout<<str3<<endl; len=str3.size(); cout<<len<<endl; getch(); }