Advertisement
AnandaVieira

Exercicio 45

May 9th, 2021
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ScriptCSharp
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             /*Exercício 45 - Leia um valor inteiro em segundos, e depois mostrá-lo em horas, minutos
  11.             e segundos. */
  12.  
  13.             Console.Write("Digite uma quantidade de segundos: ");
  14.             double segundos = double.Parse (Console.ReadLine());
  15.  
  16.             double h = segundos / 3600;
  17.             double resto = segundos % 3600;
  18.             double m = resto / 60;
  19.             double s = resto % 60;
  20.  
  21.             Console.Write("Em horas: "+ h + "\nEm minutos: "+ m + "\nEm segundos: "+ s);
  22.  
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement