Created
March 21, 2020 23:49
-
-
Save Silva97/f3571727757ef604b63403830728d0a2 to your computer and use it in GitHub Desktop.
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 <stdlib.h> | |
int cmpfloat(const void *n1, const void *n2) | |
{ | |
return *( (const float *) n1 ) > *( (const float *) n2 ); | |
} | |
#define SIZE 3 | |
int main(int argc, char **argv) | |
{ | |
float numbers[SIZE]; | |
printf("Digita os bagulho: "); | |
scanf("%f%f%f", &numbers[0], &numbers[1], &numbers[2]); | |
qsort(numbers, SIZE, sizeof *numbers, cmpfloat); | |
for (int i = 0; i < SIZE; i++) | |
printf("%.2f, ", numbers[i]); | |
putchar('\n'); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment