May 15, 2023
Program to use while loop in C Language
#include <stdio.h>
int main()
{
int i=1;
while(i<=5)
{
printf("%d\t ",i);
i++;
}
return 0;
}
Output
1 2 3 4 5
- Declare integer variable
- Initialize in integer variable
i = 1
- While
(i<=5)
condition which needs to be evaluated pintf
inbuild function to display the value of%d
- code of instructions which needs to be executed
i++
increment value
by : Nadeem Khan
Quick Summary:
While loop