The source code of this programme is :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
void main() | |
{ | |
int num[5]; | |
int a,b,help; | |
printf("enter 5 numbers="); | |
for(a=0;a<5;a++) | |
{ | |
scanf("%d",&num[a]); | |
} | |
for(a=0;a<5;a++) | |
{ | |
for(b=a+1;b<5;b++) | |
{ | |
if (num[b]>num[a]) | |
{ | |
help=num[b]; | |
num[b]=num[a]; | |
num[a]=help; | |
} | |
} | |
} | |
for(a=0;a<5;a++) | |
{ | |
printf("\n%d",num[a]); | |
} | |
getch(); | |
} |
0 comments :
Post a Comment