What is the syntax of the while construct in the c programmi
What is the syntax of the \"while\" construct in the c programming language? Show how the while construct can give the functionality of the \"for\" construct, for (init-phrase; test-cond; incr-phrase)
Solution
The syntax of while loop in c is as
while(condition)
 {   
    statements;
}
To make a for loop functionality using while use a variable and intialize it outside loop and increment inside of the loop as
int i=0; // Intialization
while(i< 10) // testcond
{
 printf(\"%d \", i);
   i++; // Increment
}

