Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void troca (int *x , int *y)
- {
- int temp ;
- if (*x > *y)
- {
- temp = *y ;
- *y = *x ;
- *x = temp ;
- }
- }
- void ordena (int *valorA , int *valorB , int *valorC)
- {
- troca (valorA , valorB) ;
- troca (valorA , valorC) ;
- troca (valorB , valorC) ;
- }
- int main ()
- {
- int a , b , c ;
- printf ("Insira os valores a ordenar: ") ;
- scanf ("%d %d %d" , &a , &b , &c) ;
- ordena (&a , &b , &c) ;
- printf ("Valores a, b, c ordenados por ordem crescente: %d %d %d\n" , a , b , c) ;
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment