Getting Started With C

while statements

The while Loop is an entry-controlled loop in C programming language. This loop can be used to iterate a part of code while the given condition remains true.

Syntax:

  while (test expression)
{
// body consisting of multiple statements
}

 

Explanation:

sample code:

Program.c

output:

output.c

Resources :

Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Q1. Choose correct C while loop syntax.

Q2. What is the output of C Program.?

 int main()
                      {
                          while(true)    
                          {
                              printf("RABBIT");
                              break;
                          }
                          
                          return 0;
                      }