Write a program to print numbers in ascending order
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1;
clrscr();
printf("Enter the number: ");
scanf("%d",&n);
while(i<=n)
{
printf("%d,",i);
i++;
}
printf("\b.");
getch();
}
Output:
Enter the number: 10
1,2,3,4,5,6,7,8,9,10.
No comments: