Five weekends: Difference between revisions

m
No edit summary
Line 532:
 
=={{header|Amazing Hopper}}==
<p>VERSION 1</p>
<syntaxhighlight lang="txt">
#include <jambo.h>
Line 633 ⟶ 634:
Total de años con weekend de 5 días = 201
</pre>
<p>VERSION 2</p>
<p>Esta versión genera el mismo resultado, sin hacer uso de la macro "calendar":</p>
<syntaxhighlight lang="txt">
#include <jambo.h>
 
#define __PRNNL__ {"\n"}print
#synon __PRNNL__ *Print it
 
Main
Set stack 15
 
Init zero ( candidato, total, columna, fecha)
/* 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 ( candidato := [i] Of 'mes largo' )
Let ( fecha := Multicat ("1/",Str(candidato),"/",Str(año)) )
 
When ( Strday(fecha) Is equal to '"Viernes"', \
And ( Equals(Daysofmonth(fecha),31)) ) {
++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
</syntaxhighlight>
 
=={{header|AppleScript}}==
543

edits