Advertisement
FAMDS

1

Nov 15th, 2022 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. int main(){
  5.  
  6. //1. Fazer um programa para
  7. //a. receber do usuário um tempo em segundos, correspondente à duração de um evento qualquer (por ex. jogo de futebol)
  8.  
  9. int a,m,s;
  10. float h;
  11.  
  12. printf("Informe os segundos do evento:");
  13. scanf("%d",&a);
  14.  
  15. //b. calcular e mostrar ao usuário o tempo equivalente em horas, minutos e segundos
  16.  
  17. m=a/60;
  18. h=a/3600;
  19. s=a;
  20.  
  21. printf("O tempo em horas ..........:%.1f horas\n",h);
  22. printf("O tempo em minutos ........:%d minutos\n",m);
  23. printf("O tempo em segundos .......:%d segundos\n",a);
  24. return 0;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement