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!
Follow

You studied Motion Picture and Television at the American Academy of Dramatic Arts and The Edgemar Center for the Arts in Santa Monica. What was it like going from learning about film and television to actually working in the industry?

View Full Interview

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)

Setting Number Formats in Excel

A spreadsheet in Excel is comprised of a grid of cells. Each cell (which is defined as the intersection between a row and a column) can be allocated its own attributes. This i (MORE)

Counting: Activities and Number Crafts for Preschoolers

Your preschool-aged child is at a point in his or her young life when learning is incredibly fun and entertaining. Even though attention spans are very short, their ability to (MORE)
In Puzzles

Challenging Your Brain: Number Games for Adults

Test your brain power every day with a few number games for adults online. Memory and math games improve your thinking skills and enhance your brain to act quickly in order to (MORE)
In Bible

Introduction to the Book of Numbers

The book of Numbers is the fourth book in the Bible. It chronicles the history of the Hebrew people, following the giving of the Ten Commandments to Moses at Mount Sinai. It i (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)

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)