Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void converte(int tipo , int *vSegs , int *mnts , int *segs)
- {
- if (!tipo)
- {
- *mnts = *vSegs / 60 ;
- *segs = *vSegs % 60 ;
- }
- else *vSegs = *mnts * 60 + *segs ;
- }
- int main()
- {
- int tipo , vSegs , mnts , segs ;
- printf ("Escolha o tipo de dados que vai introduzir : ") ;
- scanf ("%d" , &tipo) ;
- if (!tipo)
- {
- printf ("Introduza o valor total de segundos : ") ;
- scanf ("%d" , &vSegs) ;
- }
- else
- {
- printf ("Introduza o valor de minutos e segundos : ") ;
- scanf ("%d %d" , &mnts , &segs) ;
- }
- converte(tipo , &vSegs , &mnts , &segs) ;
- if (!tipo) printf ("Valor convertido para minutos e segundos : %d:%d\n" , mnts , segs) ;
- else printf ("Valor convertido para segundos : %d\n" , vSegs) ;
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment