Sorting And Reversing Of An Array

  • Uploaded by: SRINIVASA RAO GANTA
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Sorting And Reversing Of An Array as PDF for free.

More details

  • Words: 92
  • Pages: 2
Record 20 : Sorting and Reversing of an Array var a=new Array(5); a=[4,7,2,18,10]; ascend(a); descend(a); var i,j,temp=0; function ascend(a:Number):Void { for(i=0;i<5;i++) { for(j=0;j<5;j++) { if(a[i]a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } } trace("Descending order of given numbers is:"); for(i=0;i<5;i++) { trace(a[i]); } } ----------------------------------------------------------------------------output ---------------------------------------------------------------------------Ascending order of given numbers is: 2 4 7 10 18 Descending order of given numbers is:

18 10 7 4 2

Related Documents

Array An
August 2019 14
Sorting
May 2020 22
Sorting
July 2020 22
Sorting
April 2020 18

More Documents from "dwianto agung siwitomo"