While Loop Programs in C
Get Certified in C Programming and Take Your Skills to the Next Level
Program 1
// Program for while loop
#include<stdio.h>
#include<conio.h>
int main()
{
system("cls");
int i=1; // intilization
int limit;
printf("Enter the limit");
scanf("%d",&limit);
while(i<=limit) // condition
{
printf("%d ",i);
i++; // increment
}
return 0;
}Program 2
// Program for Table of number
#include<stdio.h>
#include<conio.h>
int main()
{
system("cls");
int n,i;
printf("Enter the number");
scanf("%d",&n);
i=1;
while(i<=10)
{
printf("%d\n",n*i);
i++;
}
return 0;
}Program 3
// Program for Series
#include<stdio.h>
#include<conio.h>
int main()
{
system("cls");
int limit,i;
printf("Enter the limit");
scanf("%d",&limit);
i=1;
while(i<=limit)
{
printf("%d\n",i*i);
i++;
}
return 0;
}Program 4
// Program for Series
#include<stdio.h>
#include<conio.h>
int main()
{
int i=10;
while(i)
{
printf("\n%d",i);
i--;
}
return 0;
}
Your opinion matters
Please write your valuable feedback about DataFlair on Google

