* In this tutorial, we will learn about the C++ for loop and its working with the help of some examples.
* In computer programming, loops are used to repeat a block of code.
* For example, let's say we want to show a message 100 times. Then instead of writing the print statement 100 times, we can use a loop.
* That was just a simple example; we can achieve much more efficiency and sophistication in our programs by making effective use of loops.
syntax of for loop :
for (initialization; condition; update) {
// body of-loop
}
#include<iostream>
using namespace std;
int main()
{
int i;
for ( i<0 ; i <=10 ; i++)
{
cout<<" driodhan "<<endl;
}
return 0;
}
0 Comments