While Loop

The While Looping statement is used for the same purpose as For , the only difference being that condition is checked in the main statement while increment/decrement is done inside loop .


Syntax for 'While Loop'


while ( condition check  )



Example :while(i<7)




C Example


#include<stdio.h>

#include<stdio.h>

int main() {

	int i=1;

	while(i<6) {

		printf("%d\n",i);

		i=i+1;

	}

	printf("loop over");

	return 0;

}


Quantitative Aptitude
Reasoning
Programming
Interview