47. C Program to Display 1 to 99 Numbers in 5 Columns Sequential order.
How does this program work?
- This program is used to print 100 numbers for 5numbers in each column.
- Here we learn how to use loops concept to display numbers.
- Here we used for loop to print numbers.
Here is the code
#include <stdio.h>
int main(void)
{
//To Print 1 to 100 numbers in 5 columns
int a=5, i, j = 1, x = 0;
for(i = 1; i <= a; i++)
{
while(x < 20)
{
printf("%d ", j++ );
x++;
}
x = 0;
printf("\n");
}
return 0;
}