Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 5
- //9. Leia um conjunto de números. Exiba-os em ordem numérica crescente.
- int main()
- {
- int conjunto[5]={2,3,5,1,0},i,j,aux;
- for(i=0;i<MAX;i++)
- {
- for(j=0;j<MAX-1;j++)
- {
- if(conjunto[j]>conjunto[j+1])
- {
- aux=conjunto[j];
- conjunto[j]=conjunto[j+1];
- conjunto[j+1]=aux;
- }
- }
- }
- for(i=0;i<MAX;i++)
- {
- printf("\n %d",conjunto[i]);
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement