c program to arrange numbers in descending order

/* C program to arrange numbers in descending order DescOrder.C */

#include <stdio.h>
 
void main ()
{
 //variable declaration
 int number[30];
 int i, j, a, n;

 //asking user to enter size of array 
 printf("Enter the value of N\n");
 scanf("%d", &n); //reading array size
 
 //asking user to enter array elements
 printf("Enter the numbers \n"); 
 for (i = 0; i < n; ++i)
  scanf("%d", &number[i]); //reading array elements

 /* Logic for sorting and checking */

 for (i = 0; i < n; ++i)
 {
   for (j = i + 1; j < n; ++j)
   {
    if (number[i] < number[j])
    {
     a = number[i];
     number[i] = number[j];
     number[j] = a;
   }
  }
 }
 
 printf("The numbers arranged in descending order are given below\n");
 for (i = 0; i < n; ++i)
 {
   printf("%d\n", number[i]); //printing numbers in descending order
 }
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
c program to arrange numbers in ascending order using array c program to display numbers in ascending and descending order number ascending order c how to arrange array in descending order in c c program to print numbers in ascending order c program to print in ascending order c program to ask user number and sort in descending order arrange number in ascending order in c c program to arrange numbers in ascending order c program to arrange numbers in descending order using array c program to sort numbers in ascending order write a c program to find ascending order ascending order c program 10 arrange 4 numbers in descending order in c without using array c program to sort a set of numbers in ascending order arrange numbrs in ascending order in c arrange-numbers-in-ascending-descending-order using arrays in c c program to arrange the given set of numbers in ascending and descending order Write a C program to sort a set of numbers in ascending and descending order c program for sorting array in descending order c program to read an array of 10 integers and sort using in descending using function c program to put numbers in ascending order printing ascending and descending order of n numbers in c arrange numbers in descending order in c sort numbers in c program c program to sort array elements in ascending or descending order arrange 4 numbers in descending in C c program to arrange n numbers in ascending order c program to sort integers in ascending order c programming sorting numbers in descending order Write a program that prints out all the numbers from 100 to 1 in descending order in C print numbers in ascending order in c sort integer in descending order C program arrange the digits of a number in descending order in c how to print numbers in descending order in c how to make a program in c to to number numbers in ascending and descending order arranging array elment to accending or and decinding sort array elements in ascending order in c standard method sorting element in ascending order using function in c sort elements in ascending order c function arranging in descending order array c for descending C sorting an array in descending order algorithm to sort numbers in descending order in C array in descending order c c program for selection sort in descending order sort elements in an array in descending order sorting array in descending order descending sort in c c program for descending order write a c program to sort a string array in ascending order sort array in descending order in c decreasing order sort in c write a program to sort the array in descending order of the frequency of the elements write a program to sort elements of an array in descending order arrange array in descending order ascending order descending order program in c descending sort in c c program to sort array in ascending and descending order c program to sort the given numbers in an descending order in by programiz c program to sort the given numbers in an descending order sort array in decending order in c code for sorting array in ascending order in c descending order sorting in c array sorting in c des program to sort an array in ascending and descending order c program to arrange a list of integers in ascending order in merge sort selection sort in descending order in c sort in descending order array linux c language descending order C bubble sort array in descending order in c how to print array in descending order ascending descending in c sort the array in descending order a program to get 5 number output from desending in c c function to sort an array in descending order c program to sort array in descending order Arrangement in descending order PROGRAM ON C sort in descending order in c c sort int array descending sort in decending C c program to sort n numbers in descending order sortning array number in descending order c programing sort array in descending order c program c program to find descending order how to rank array by sorting it in descending order in c I sorted them in descending order descending sort array autometa ascending order in c program c program ascending order 4. Sort the numbers in ascending and descending order in c program descending order of array bubble sort descending order in c arrenge number in array in descending order print numbers in descending order sorting algorithm in descending order in c array descending order in c descending order c program how to order numers in c c array descending order descending sort array sort an array in descending order in c descending order array in c sort array elements in descending order sorting items in an array in descending order c program to sort an array in descending order c code for sorting array in descending order array in descending order sort array in c descending c program to sort an array in ascending and descending order c program to arrange numbers in descending order
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source