Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main ()
- {
- int i,j,a,n,m[50];
- printf("Enter the value of N \n");
- scanf("%d",&n);
- printf("Enter the number \n");
- for(i=0;i<n;i++)
- scanf("%d",&m[i]);
- for(i=0;i<n;i++)
- {
- for(j=i+1;j<n;j++)
- {
- if(m[i]> m[j])
- {
- a=m[i];
- m[i]=m[j];
- m[j]=a;
- }
- }
- }
- printf("The numbers arranged in ascending order are given below \n");
- for(i=0; i<n ;i++)
- printf("%d\n",m[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment