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

#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
Thanks for the feedback!

Write a c program to sort the elements of the matrix in ascending order?

include<stdio.h>   main()   {   printf("Enter Order Of The Matrix\\n");   int l,m;   int i,j,k,t,x;   scanf("%d%d",&l,&m);   int a[l][m],tem (MORE)

Write a program to find the largest of three numbers and print the output in ascending order?

void main(){int a,b,c;clrscr();printf("Enter the value of a:");scanf("%d",&a);printf("\\nEnter the value of b:");scanf("%d",&b);printf("\\nEnter the value of c:");scan (MORE)

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

include<stdio.h> #include<conio.h> void main() { int i,j,temp,a[7]; clrscr(); printf("Enter 7 integer numbers: \\n"); for(i=0;i<7;i++) scanf("%d",&a (MORE)

Write a c program to sort 10 numbers in ascending order?

#include<stdio.h>#include<conio.h> void main() { int num[10],i,j,temp; clrscr(); printf("\\n Enter 10 values of an array.....\\n"); for(i=0;i<10;i++) scanf("%d" (MORE)
In Math

Foolproof Ways to Make Numbers Fun for Elementary Students

The educational path to becoming an elementary school teacher is filled with tips and techniques to help teachers generate interest and capture the attention of young students (MORE)
In Grammar

Addressing the Dilemma of Using Numbers in Writing

If your writing piece includes the description of numbers or dates, you may find yourself wondering how to express them. Many sources vary on this topic but the one rule that (MORE)

Wedding Programs That Create Memories

Designing a wedding program that can help create memories, can be done in so many ways. The order to the wedding program can play a big part in how memorable it is. Nothing wi (MORE)

Requirements for Writing Numbers on Checks

A check is a secure way of sending money to other people. Checks are a good alternative to cash, which may not be secure to carry around in large amounts. The other reason for (MORE)

How do you write a java program to sort n numbers in ascending order?

It should be fairly simple to program a bubble sort (though this is not very efficient for large arrays). If elements #0 and #1 of an array are out of order, exchange them. Th (MORE)

Write a program to arrange given set of number in ascending order using link lists in c language?

include <stdio.h> #include <conio.h> int main() { int a[10],i,j,temp=0; printf("Enter all the 10 numbers"); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0; (MORE)

How do you write a program in C to ascend n numbers?

  #include <stdio.h> main() { int n,i,j,a[10][10],t; clrscr(); printf("enter the limit of an array\\n"); scanf("%d",&n); printf("enter the elments of an a (MORE)

Sorting of numbers in ascending order in c plus plus program?

// simple bubble sort - ellipses (...) used to indicate indentation for clarity// an array - size 20 - could be anythingint a[20] = {1, 7, 5, 3, 7, 9, 67, 4, 20, 45, 76, 23, - (MORE)