0

I am trying to convert an integer representing a month (1=january, 2=february.. 12=december) to an integer representing that month but in julian counting (1=march, 2=april.. 12=february). However I can only use integers and basic arithmetic (-,+,/,* and modulo).

for example:

month->julianMonth  
1->11  
2->12   
3->1   
4->2   
5->3  
...

The closest I get is with

julianMonth=(month+10)%12

which returns every value right but february.

octavio
  • 456
  • 4
  • 14

1 Answers1

0

Okay, got it:

julianMonth=(month+9)%12+1 
octavio
  • 456
  • 4
  • 14