Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Five-weekends/Harbour/five-weekends.harbour
Normal file
34
Task/Five-weekends/Harbour/five-weekends.harbour
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
PROCEDURE Main()
|
||||
LOCAL y, m, d, nFound, cNames, nTot := 0, nNotFives := 0
|
||||
LOCAL aFounds := {}
|
||||
|
||||
SET DATE ANSI
|
||||
|
||||
FOR y := 1900 TO 2100
|
||||
nFound := 0 ; cNames := ""
|
||||
FOR m := 1 TO 12
|
||||
d := CtoD( hb_NtoS( y ) +"/" + hb_NtoS( m ) + "/1" )
|
||||
IF CDoW( d ) == "Friday"
|
||||
IF DaysInMonth( m ) == 31
|
||||
nFound++
|
||||
cNames += CMonth( d ) + " "
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
IF nFound > 0
|
||||
AAdd( aFounds, hb_NtoS( y ) + " : " + hb_NtoS( nFound ) + " ( " + Rtrim( cNames ) + " )" )
|
||||
nTot += nFound
|
||||
ELSE
|
||||
nNotFives++
|
||||
ENDIF
|
||||
NEXT
|
||||
? "Total months with five weekends: " + hb_NtoS( nTot )
|
||||
? "(see bellow the first and last five years/months with five weekends)"
|
||||
?
|
||||
AEval( aFounds, { | e, n | Iif( n < 6, Qout( e ), NIL ) } )
|
||||
Qout("...")
|
||||
AEval( aFounds, { | e, n | Iif( n > Len(aFounds)-5, Qout( e ), NIL ) } )
|
||||
?
|
||||
? "Years with no five weekends months: " + hb_NtoS( nNotFives )
|
||||
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue