C while-loop

<<Previous

Next >>





The syntax of while loop

while(expression)
  statement;

       (or)

while(expression)
{
  statements;
}

Here, first the expression is evaluated. If the conditional expression is true, statements inside the while loop will be executed after which the expression is reevaluated. This process continues until the conditional expression is false. When the condition is false, the while loop will be terminated.



Following is an example C Program using while loop.

#include<stdio.h>

int main()
{
  int b = 0;

  while(b <= 5)
  {
    printf("The value of b = %d\n",b);
    b++ ;
  }

  printf("The final value of b = %d\n",b);

  return(0);

}

When you compile and execute the above program, then you will get the following output:



<< Previous

Next >>







C while-loop

<<Previous

Next >>





The syntax of while loop

while(expression)
  statement;

       (or)

while(expression)
{
  statements;
}

Here, first the expression is evaluated. If the conditional expression is true, statements inside the while loop will be executed after which the expression is reevaluated. This process continues until the conditional expression is false. When the condition is false, the while loop will be terminated.



Following is an example C Program using while loop.

#include<stdio.h>

int main()
{
  int b = 0;

  while(b <= 5)
  {
    printf("The value of b = %d\n",b);
    b++ ;
  }

  printf("The final value of b = %d\n",b);

  return(0);

}

When you compile and execute the above program, then you will get the following output:



<< Previous

Next >>







Learn about Hashing and Hash table

Learn Expression Tree

OS Kernel Architecture

OS Arcitecture of Windows, Linux and MacOS

Learn OS scheduling Algorithms