01-02-2025, 03:16 AM
(01-02-2025, 02:15 AM)eoredson Wrote: I can squash that code into 2 lines:We'z up ta squishing things? I love'z squishing things! Stompity, stomp, stomp, stomp....Take that, varmint!
Code: (Select All)Rem determine day of week.
Print "Enter Month,Day,Year";: Input m%, d%, y%
If m% < 3 Then m% = m% + 12: y% = y% - 1
W% = ((13 * m% + 3) \ 5 + d% + y% + y% \ 4 - y% \ 100 + y% \ 400 + 1) Mod 7
Print "Weekday is on: ";
If W% = 0 Then Print "Sunday"
If W% = 1 Then Print "Monday"
If W% = 2 Then Print "Tuesday"
If W% = 3 Then Print "Wednesday"
If W% = 4 Then Print "Thursday"
If W% = 5 Then Print "Friday"
If W% = 6 Then Print "Saturday"
End
Code: (Select All)
Rem determine day of week.
map$ = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
Print "Enter Month,Day,Year";: Input m%, d%, y%
If m% < 3 Then m% = m% + 12: y% = y% - 1
W% = ((13 * m% + 3) \ 5 + d% + y% + y% \ 4 - y% \ 100 + y% \ 400 + 1) Mod 7
Print "Weekday is on: "; RTrim$(Mid$(map$, 10 * W% + 1, 10))
End
- Sam
Shoot first and shoot people who ask questions, later.