Created
April 4, 2013 14:35
-
-
Save FernandaBernardo/5310856 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
/* | |
*Dado o tempo em horas, minutos e segundos, imprimir esse tempo em segundos. | |
*/ | |
import java.util.Scanner; | |
class Tempo | |
{ | |
public static void main (String [] args) | |
{ | |
Scanner sc = new Scanner(System.in); | |
int s, m, h; | |
System.out.println("Digite o tempo a ser transformado em segundos. Digite primeiro horas, entao minutos e depois segundos"); | |
h = sc.nextInt(); | |
m = sc.nextInt(); | |
s = sc.nextInt(); | |
int tempo = ((h*3600) + (m*60) + s); | |
System.out.println ("O tempo em segundos eh: " +tempo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment