import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        Scanner tec = new Scanner (System.in);
        System.out.println("Introdue tu tiempo a transformar en segundos");
        int ValorSeg = tec.nextInt();

        //salida
        int ValorMin = ValorSeg/60;
        int seg = ValorSeg%60;
        int ValorHor = ValorMin/60;
        int min = ValorMin%60;
        int ValorDias = ValorHor/24;
        int hor = ValorHor%24;
        // bloque de salida
        String s = " segundos, ";
        String m = " minutos, ";
        String h = " horas, ";
        String d = " dia, ";
        if (ValorDias == 1){
            d=" dia, ";
        }
        if (hor == 1){
            h=" hora, ";
        }
        if (min == 1){
            h=" minuto, ";
        }
        if (seg == 1){
            h=" segundo, ";
        }
        System.out.println("El resultado es:"+ValorDias+d+hor+h+min+m+seg+s);
    } 
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: