while Loop in C
while loops allows to repeatedly execute the same block of code until a condition is met.
while loop has one control condition, and executes as long as the condition is true.
Syntax
        
while(condition) {
    //Statements or Code
}         
        
    
    Program
        
#include <stdio.h>
int main ()
{
    int num = 10;
                
    /* while loop execution */
    while(num < 20)
    {
        printf("Value of num : %d\n", num);
        num++;
    }
    return 0;
}
                             
        
    
    Output
        
Value of num : 10
Value of num : 11
Value of num : 12
Value of num : 13
Value of num : 14
Value of num : 15
Value of num : 16
Value of num : 17
Value of num : 18
Value of num : 19            
        
    
Join Our Social Media Connections
0 Comments