Explain for loop with example.
Answers
Answered by
6
for loop is an entry controlled loop that repeats its body for a fixed no. of times which is known to us...
Eg:-
for( int i = 1; i < = 5; i ++ )
System.out.println( " hello world " );
So this for loop will print hello world 5 times...
Answered by
1
For loop in C++ with example. A loop is used for executing a block of statements repeatedly until a particular condition is satisfied. For example, when you are displaying number from 1 to 100 you may want set the value of a variable to 1 and display it 100 times, increasing its value by 1 on each loop iteration.
Similar questions
Psychology,
6 months ago
Math,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago