#include #context Obtiene suma de días de weekend Args ( Domingo, Viernes, Sábado ) Not zero( Val( [3:end,Domingo] Of 'calendario' )), Get summatory Not zero( Val( [3:end,Viernes] Of 'calendario' )), Get summatory, Add it Not zero( Val( [3:end,Sábado ] Of 'calendario' )), Get summatory, Add it Return\\ #define __PRNNL__ {"\n"}print #synon __PRNNL__ *Print it #defn Paralosdías(*) #GENCODE $$$*$$$ #ATCMLIST; #ENDGEN; #enum 1,DOMINGO,6,VIERNES,7,SABADO Main Set stack 15 Init zero (calendario, candidato, total, columna) /* Configura meses */ Meses={}, mes largo = {} Let list ( Meses := "Enero ","Febrero ","Marzo ","Abril ","Mayo ",\ "Junio ","Julio ","Agosto ","Septiembre","Octubre ",\ "Noviembre ","Diciembre " ) Let list ( mes largo := 1, 3, 5, 7, 8, 10, 12 ) /* Busca los meses con weekend larguísimo */ Loop for (año = 1900, #( año <= 2100), ++año) Loop for( i=1, #(i<=7), ++i) Let ( calendario := Calendar( [i] Of 'mes largo' ---Backup to 'candidato'---,año,1) ) Para los días 'DOMINGO, VIERNES, SABADO' Obtiene suma de días de weekend When ( Is equal to '15' ){ ++total, Print (año," : ", [candidato] Of 'Meses'," | ") When ( columna++ Is equal to '3' ) { Prnl, columna=0 } } Back Back Set ( Utf8("\nTotal de años con weekend de 5 días = "), total ), and Print it End Subrutines