20120118

How to use tricky while loop in CPP,C++,C

#include<stdio.h>
int main()
{
int i=0;
while(i<5)
        {
        printf("\n Iteration No=%d",i);
        }
return 0;
}
////////////////////
o/p = infinite times Iteration No=0 as we are not incrementing the i
///////////////////



////////////////////
Program 2
//////////////////////
#include<stdio.h>
int main()
{
int i=0;
while(i<5);//infinite loop within as 0 will be always < 5 so flow will not go to next stment so no o/p
        {
        printf("\n Iteration No=%d",i);
        i++;//
        }
return 0;
}
// O/P = No o/p

Previous                             Home                               Next

1 comment:

  1. How to use tricky while loop in CPP,C++,C
    How to use tricky while loop in CPP,C++,C
    How to use tricky while loop in CPP,C++,C
    How to use tricky while loop in CPP,C++,C

    ReplyDelete