Page 88 - CITS - CSA - TP (Volume 2) - Hindi
P. 88
कं ूटर सॉ वेयर ए ीके शन - CITS
सभी पुनरावृि यों और एलीम ट की तुलना के बाद, हम एक सॉट ड ऐरे ा होती है।
टा 4: अवरोही म म सॉट ड ऐरे
// Sort array in descending order
import java.util.Scanner;
public class BubbleSortDescending {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Prompt the user to enter the number of elements
System.out.print(“Enter the number of elements: “);
int n = scanner.nextInt();
// Create an array of the specified size
int[] arr = new int[n];
// Prompt the user to enter array elements
System.out.println(“Enter the elements of the array:”);
for (int i = 0; i < n; i++) {
74
CITS : IT & ITES - कं ूटर सॉ वेयर ए ीके शन - अ ास 93

