46. C Program to Display 1 to 99 Numbers in 5 Rows Sequential order.
How does this program work?
- This program is used to print 100 numbers for 5numbers in each line.
- Here we learn how to use loops concept to display numbers.
- Here we used two loops for loop and while loop.
Here is the code
#include <stdio.h>
int main(void)
{
int number=1;
//Print statement
printf("Numbers from 1 to 100: \n");
//While loop, that will print numbers
//From 1 to 100
while(number<=100)
{
//For loop to print 5 numbers in a line
for (int i=1;i<=5;i++)
{
//Printing the numbers
printf("%d ",number);
//Increasing loop counter by 1
number++;
}
printf ("\n ");
}
return 0;
}