Enter 10 number using array and display it in descending order Using Pointer in C Language
void main() { int no[10],i,j,*temp; clrscr(); printf("enter 10 no:"); for(i=0;i<=9;i++) { scanf("%d",&no[i]); } printf("\ndiscending:"); for(i=0;i<=9;i++) { for(j=0;j<=9;j++) { if(*(no+i)>*(no+j)) { *temp=*(no+i); *(no+i)=*(no+j); *(no+j)=*temp; } } } for(i=0;i<=9;i++) { printf("\n%d",no[i]); } getch(); }Output:
10 5 2 3 9 8 6 7 4 1 Decending Order: 10 9 8 7 6 5 4 3 2 1
Enter 10 number using array and display it in descending order Using Pointer in C Language
Reviewed by Unknown
on
8:05:00 PM
Rating:
No comments: