You are on page 1of 2

KARTIK V / 11 A / 11122

12.WAPT arrange a character array in reverse of the alphabetical order.


class chararray { char ch[]=new char[10]; char temp;int n; public void accept(char c[],int num) { for(int i=0;i<num;i++) { ch[i]=c[i]; } n=num; } void bsort() { temp='\0'; for(int i=0;i<n;i++) { for(int j=1;j<n;j++) { if(ch[j]>ch[j-1]) { temp=ch[j]; ch[j]=ch[j-1]; ch[j-1]=temp; } }}}

KARTIK V / 11 A / 11122

KARTIK V / 11 A / 11122 void display() { for(int i=0;i<n;i++) System.out.print(ch[i]); } } INPUT VALUES : c o m p u t e r s OUTPUT :

KARTIK V / 11 A / 11122

You might also like