answersLogoWhite

0

#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[i]);

for (i=0;i<7;i++)

{

for(j=i+1;j<7;j++)

{

if(a[i]<a[j])

{

temp=a[i];

a[i]=a[j];

a[j]=temp;

}

}

}

printf("\n\nThe 7 numbers sorted in ascending order are: \n");

for(i=0;i<7;i++)

printf("%d\t",a[i]);

getch();

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Java program to arrange any numbers in ascending order using scanner classes?

To arrange numbers in ascending order using Java, you can utilize the Scanner class to read input from the user and then sort the numbers using an array. Here's a simple example: import java.util.Arrays; import java.util.Scanner; public class AscendingOrder { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print(&quot;Enter the number of elements: &quot;); int n = scanner.nextInt(); int[] numbers = new int[n]; System.out.println(&quot;Enter the numbers:&quot;); for (int i = 0; i &lt; n; i++) { numbers[i] = scanner.nextInt(); } Arrays.sort(numbers); System.out.println(&quot;Numbers in ascending order: &quot; + Arrays.toString(numbers)); scanner.close(); } } This program collects a specified number of integers from the user, sorts them using Arrays.sort(), and then displays the sorted list.


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


What does descending mean in maths?

In Maths, we often talk about ascending and descending order. Ascending order is writing numbers from smallest to largest. Descending order is writing numbers from largest to smallest.


Ascending order program for java?

public class BubbleSortAscendingOrderDemo { public static void main(String a[]) { //Numbers which need to be sorted int numbers[] = {23,5,23,1,7,12,3,34,0}; //Displaying the numbers before sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i &lt; numbers.length; i++) { System.out.print(numbers[i]+" "); } System.out.println(); //Sorting in ascending order using bubble sort bubbleSortInAscendingOrder(numbers); //Displaying the numbers after sorting System.out.print("Before sorting, numbers are "); for(int i = 0; i &lt; numbers.length; i++) { System.out.print(numbers[i]+" "); } }


What is the algorithm to input 3 numbers and output them in ascending order?

To sort three numbers in ascending order, you can use a simple comparison-based algorithm. First, compare the first two numbers and swap them if the first is greater than the second. Then, compare the second number with the third and swap if necessary. Finally, check the first number against the second again to ensure they are in order. This process will yield the numbers in ascending order.

Related Questions

What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


Draw a flowchart to arrange 3 numbers in ascending order?

draw a flow chart to arrange 3 numbers in ascending order


How do you arrange 4 numbers in ascending order without array?

addends


What is it called when you arrange numbers from greatest to least?

This is known as arranging the numbers in ascending order.


Which way is ascending and descending?

Ascending means increasing in value or moving higher, while descending means decreasing in value or moving lower. In a numeric sequence, ascending would go from lowest to highest, while descending would go from highest to lowest.


How do you arrange the numbers 7 9 56 and 72?

To arrange the numbers 7, 9, 56, and 72 in ascending order, you would start by comparing the numbers from left to right. The smallest number is 7, followed by 9, then 56, and finally 72. So, the numbers arranged in ascending order would be 7, 9, 56, and 72.


How do you work out the median for a set of eight numbers?

Arrange the numbers in ascending order, and then take the mean of the fourth and fifth number.


How to find the smallest number?

When you are given some numbers just arrange them in ascending order and you will the smallest number which can be made out of those given numbers.


How do you arrange these numbers 22.8 8.2 8.02 28.2 2.8?

In ascending order: 2.8, 8.02, 8.2, 22.8, 28.2


How do you arrange the set of numbers 4.8 4.9 4.78 4.89 from least to greatest is what?

4.78 4.8 4.89 4.9 are the numbers arranged in ascending order.


How do you arrange numbers in ascending order in qbasic programming?

To arrange numbers in ascending order in QBASIC, you can use a simple sorting algorithm like bubble sort. First, store the numbers in an array. Then, repeatedly compare adjacent elements and swap them if they are in the wrong order until the entire array is sorted. Here's a basic example: DIM numbers(5) AS INTEGER ' (Assume numbers are already populated) FOR i = 0 TO 4 FOR j = 0 TO 4 - i - 1 IF numbers(j) &gt; numbers(j + 1) THEN SWAP numbers(j), numbers(j + 1) END IF NEXT j NEXT i This will sort the array numbers in ascending order.


Java program to arrange any numbers in ascending order using scanner classes?

To arrange numbers in ascending order using Java, you can utilize the Scanner class to read input from the user and then sort the numbers using an array. Here's a simple example: import java.util.Arrays; import java.util.Scanner; public class AscendingOrder { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print(&quot;Enter the number of elements: &quot;); int n = scanner.nextInt(); int[] numbers = new int[n]; System.out.println(&quot;Enter the numbers:&quot;); for (int i = 0; i &lt; n; i++) { numbers[i] = scanner.nextInt(); } Arrays.sort(numbers); System.out.println(&quot;Numbers in ascending order: &quot; + Arrays.toString(numbers)); scanner.close(); } } This program collects a specified number of integers from the user, sorts them using Arrays.sort(), and then displays the sorted list.