Question:
How can you sort the elements of the array in descending order?
Answer:
By calling Sort() and then Reverse() methods. Source: CoolInterview.com
By calling Sort() and then Reverse() methods Source: CoolInterview.com
Answered by: srihariraju | Date: 3/31/2010
| Contact srihariraju
#include<stdio.h> main() { int a[10],sum=0; int i,j,temp; printf("enter the arraya"); for(i=0;i<10;i++) { scanf("%d",&a[i]); //sum=sum+a[i]; } for(i=10;i>=0;i--) { for(j=0;j<10;j++) { if(a[i]==a[j]) printf("%d
",a[j]); } } } Source: CoolInterview.com
Answered by: Byka.swapna | Date: 8/29/2010
| Contact Byka.swapna
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|