This is how I fill the array, but unfortunately I can’t figure out how to insert a number into it without knocking down the order (so that after inserting the number into the array, the order of numbers would not get lost)
#include <stdio.h> int main(void) { //Creating array int a[N]; int i, j, temp; printf("Enter size of array\n"); scanf("%d", &N); printf("Enter number to create array\n"); for (i = 0; i < N; i++) scanf("%d", &a[i]); //Sorting the array ascending descending for (i = 1; i < N; i++) { temp = a[i]; for (j = i - 1; j >= 0; j--) if (temp > a[j]) { a[j + 1] = a[j]; a[j] = temp; } } //Output of sorted array for (i = 0; i < N; i++) printf("%d\n", a[i]); return 0; }