In this easy coded program, you will learn how to print numbers from a to b using while loop, where the values of both will be taken from the user.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Hope you found this 'C Program to Print Numbers from a to b using while Loop' easy, simple and helpful!
Try to solve more queries by yourself by referring more examples from BEGINC. Here you will get the most easiest code to each and every query. Keep practicing. More programs are coming.
---------------------------------------------------------------------------
Program to Print Numbers from a to b using while Loop
/*Print Numbers from a to b- while Loop*/
|
|
#include<stdio.h>
|
|
void main()
|
{
|
int
a, b;
|
|
printf("Enter First Number: ");
|
scanf("%d", &a);
|
printf("\nEnter Last Number: ");
|
scanf("%d", &b);
|
|
while(a<=b)
|
{
|
printf("%d\t", a);
|
++a;
|
}
|
}
|
Output
Enter First Number: 3
Enter Last Number: 9
3 4 5 6 7 8 9
---------------------------------------------------------------------------
Hope you found this 'C Program to Print Numbers from a to b using while Loop' easy, simple and helpful!
Try to solve more queries by yourself by referring more examples from BEGINC. Here you will get the most easiest code to each and every query. Keep practicing. More programs are coming.
Comments
Post a Comment
Please do not comment any spam links in the comment box.