### Problem statement

Write a program to accept N numbers from user and arrange them in ascending order.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include<stdio.h> int main() { int i, j, a, n, number[30]; printf("Enter number of terms\n"); scanf("%d",&n); printf("Enter the numbers\n"); for(i=0; i<n; i++) { scanf("%d",&number[i]); } for(i=0; i<n; i++) { for(j=i+1; j<n; j++) { if(number[i] > number[j]) { a = number[i]; number[i] = number[j]; number[j] = a; } } } printf("The ascending order of given numbers is:\n"); for(i=0; i<n; i++) { printf("%d\n",number[i]); } } |

**Output**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Enter number of terms 5 Enter the numbers 5 25 236 54 6 The ascending order of given numbers is: 5 6 25 54 236 |

### Ankit Wasankar

Senior Java Developer

Java 11 | Microservices | Reactjs | SQL