Write a C program to arrange 7 numbers in ascending order?

Kenneth Lagang Answered Most Recently
#include<stdio.h>
#include<conio.h>
main()
{

int x;
printf("Enter the max number of array: ");
scanf("%d", &x);



int i;
int j;
int temp;
int a[x];



system("cls");
printf("Enter %d integer numbers: \n", x);
for(i=0;i<x;i++)
scanf("%d",&a[i]);
for (i=0;i<x;i++)
{
for(j=i+1;j<x;j++)
{
if(a[i]<a[j])
{
temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
}
printf("\n\nThe %d numbers sorted in ascending order are: \n", x);
int y = x - 1;


for(i=y;i>=0;i--)
printf("%d\t",a[i]);
getch();
}
// this is a converted to c code, this program will allow you to input how many numbers you want and having the same result. as the other one ...

note: thank you wherever you are for writing this code thanks a lot!!!
9 people found this useful
In Bible

The Book of Numbers

The Bible tells us that the Exodus of Israelites out of Egypt was one of the greatest epic adventures in history. Against impossible odds, but with the help of God, Hebrew peo… (MORE)