C while Loop
C while Loop
The while
loop executes a block of code as long as the test condition evaluates to true.
Note: Unlike do while loop, In while loop, the condition is evaluated before executing the statement.
Syntax
Simple while Loop
In the following program, we will print 'Hello World' for 5 times using while
loop.
Source Code
Output
while Loop to print numbers
In the following program, we will print numbers from 0 to 4 using while
loop.
Source Code
Output
while Loop to print Elements in a Array
In the following program, we will print all the elements in an array using while
loop.
Source Code
Output
while Loop to print Array of Strings
In the following program, we will print the array of strings using while
loop.
Source Code
Output
Congratulation! you have learned everything about while
loop in C Programming.
Reminder
Hi Developers, we almost covered 98% of String functions and Interview Question on C with examples for quick and easy learning.
We are working to cover every Single Concept in C.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.