+ 3
What if for-loop?
7 Answers
+ 24
 It allows code to be executed repeatedly.Â
For instance, if you want sum of integers from 1 to 10 you can write
int sum=0;
for(int i=0;i<=10;i++)
{
sum+=i;
}
+ 3
you mean to say like "for loop" inside "if loop"
then yes this is possible like this
int x=10;
if (x>5)
{
for (int i=0;i<5;i++)
cout<<i<<endl;
}
+ 2
Sumit,
I think in thus case you don't need the if loop because the for loop do the job....right?
+ 2
@shirit
if loop can help to provide double condition check. otherwise yes only for loop will be ok
0
Yes Sumit, we called nested loop.
0
yes if doesn't need
0
plz suggest best resource for data structures and sortings



