Umme_nishat

algorithom 2

Jun 21st, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<stdio.h>
  2. int main ()
  3. {
  4. int i,j,a,n,m[50];
  5. printf("Enter the value of N \n");
  6. scanf("%d",&n);
  7. printf("Enter the number \n");
  8. for(i=0;i<n;i++)
  9. scanf("%d",&m[i]);
  10. for(i=0;i<n;i++)
  11. {
  12. for(j=i+1;j<n;j++)
  13. {
  14. if(m[i]> m[j])
  15. {
  16. a=m[i];
  17. m[i]=m[j];
  18. m[j]=a;
  19. }
  20. }
  21. }
  22. printf("The numbers arranged in ascending order are given below \n");
  23. for(i=0; i<n ;i++)
  24. printf("%d\n",m[i]);
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment