#include <stdio.h> int main () { int i = 0; int loop_count = 5; printf("Case1:\n"); while (i<loop_count) { printf("%d\n",i); i++; } printf("Case2:\n"); i=20; while (0) { printf("%d\n",i); i++; } printf("Case3:\n"); i=0; while (i++<5) { printf("%d\n",i); } printf("Case4:\n"); i=3; while (i < 5 && i >=2) { printf("%d\n",i); i++; } return 0; }
Case1:
0 1 2 3 4 Case2: 5.500000 4.500000 3.500000 2.500000 1.500000 0.500000 Case3: 2 3 4 Case4: 0 1 2 3 4 Case5: Case6: 0 1 2 Case7:
//Write a program to illustrate the use of While Loop
উত্তরমুছুন#include
int main ()
{
int i = 0,loop_count = 5;
printf("number-1\n");
while (i++<=loop_count)
{
printf("%d ",i);
}
printf("\n\nnumber-2\n");
i=10;
while (i-->5)
{
printf("%d ",i);
}
printf("\n\nnumber-3\n");
i=0;
while (i++<5)
{
printf("%d ",i);
}
printf("\n\nnumber-4\n");
i=3;
while (i < 10 && i >=2)
{
printf("%d ",i);
i++;
}
return 0;
}
#include
উত্তরমুছুনint main ()
{
int i = 0,loop_count = 5;
printf("Case1:\n");
while (i++<=loop_count)
{
printf("%d\n",i);
}
printf("Case2:\n");
i=15;
while (0);
{
printf("%d\n",i);
i++;
}
printf("Case3:\n");
i=0;
while (i++<=5)
{
printf("%d\n",i);
}
printf("Case4:\n");
i=3;
while (i < 5 && i >=3)
{
printf("%d\n",i);
i++;
}
return 0;
}