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
#include <stdio.h>
int main()
{
int i = 1;
while (i <= 5)
{
printf("%d\t", i);
i++;
}
return 0;
}
1 2 3 4 5
#include<stdio.h>
int main()
{
int k=10;
while (k>=2)
{
printf("%d\t",k);
k=k-2;
}
printf("\n");
return 0;
}
10 8 6 4 2