Buscar

6

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

clear;
clc;
function [y]=bissexto(x)
 if modulo (x, 400) == 0 then
 y = %t 
 elseif modulo (x, 4 ) == 0 & modulo(x, 100)<> 0
 y = %t 
 else
 y = %f
 end
endfunction
function [Hora]=t(hora, minuto, segundo, dia, mes, ano)
 segundo = segundo + 1 
 if segundo == 60 then
 minuto = minuto + 1
 segundo = 0
 if minuto == 60 then
 hora = hora + 1
 minuto = 0
 if hora == 24 then
 dia = dia + 1
 hora = 0
 end
 end
 end
 if (mes == 1)|(mes == 3)|(mes == 5)|(mes == 7)|(mes == 8)|(mes == 10)|(mes == 12)then
 if dia == 32 then
 dia = 1
 mes = mes + 1
 if mes == 13 then
 mes = 1
 ano = ano + 1
 dia = 1
 end
 end
 end
 if (mes == 4)|(mes == 6)|(mes == 9)|(mes ==11)then
 if dia == 31 then
 dia = 1
 mes = mes + 1
 if mes == 13 then
 mes = 1
 ano = ano + 1
 dia = 1
 end
 end
 end
 if(mes == 2)then
 if bissexto(ano)then
 if dia == 30 then
 dia = 1
 mes = mes +1
 mes = 0
 ano = ano +1
 dia = 1
 if dia == 29 then
 dia = 1
 mes = mes + 1
 if mes == 13
 mes = 1
 ano = ano + 1
 dia = 1
 end
 end
 end
 end
 end
 a = string (dia)
 b = string (mes)
 c = string (ano)
 d = string (hora)
 f = string (minuto)
 g = string (segundo)
 Hora = d+":"+f+":"+g+":"+" "+a+"/"+b+"/"+c
endfunction
ho = input ("h:")
mi= input ("mi:")
se= input ("s:")
di = input ("d:")
me = input ("m:")
an = input ("a:")
[Hora] = t(ho, mi, se, di, me, an)
disp (Hora)

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Continue navegando