C program to print the given numbers in Ascending Order

C program to print numbers in Ascending Order

In this post, i will share a C program to to print the given numbers in ascending order using simple for loop.

Let us check out the code :)



#include <stdio.h> 
#include <conio.h>
void main()
{
 int i,j,x,n,num[10];
 clrscr();
 printf("enter N: ");
 scanf("\n%d",&n);
 printf("\nEnter number:\n");
 for(i=0;i<n;i++)
 {
  scanf("%d",&num[i]);
 }
 for(i=0;i<n;i++)
 {
  for(j=i+1;j<n;j++)
  {
   if(num[i]&gtnum[j])
   {
    x=num[i];
    num[i]=num[j];
    num[j]=x;
   }
  }
 }
 printf("\nNumber arranged in ascenging order:\n");
 for(i=0;i















Happy Coding :)

Comments

Popular posts from this blog

MultiSelection of Item in Recycler View

Upload Image From Android To Php Server

Merge Sort