Skip to content

Instantly share code, notes, and snippets.

@FernandaBernardo
Created April 4, 2013 14:35
Show Gist options
  • Save FernandaBernardo/5310856 to your computer and use it in GitHub Desktop.
Save FernandaBernardo/5310856 to your computer and use it in GitHub Desktop.
/*
*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