viernes, 10 de febrero de 2012

Project Euler 19

import java.util.Calendar;
public class problem19
{
 public static void main(String[] args)
 { 
  Calendar cal = Calendar.getInstance();
  int c =0;
  for (int i = 1901; i < 2001; i++)
  {
   for (int j = 1; j <13 ; j++)
   {
    cal.set(i, j, 1);
    if(cal.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY)
    c++;
   }
   System.out.println(c);
  }
 }
}

No hay comentarios:

Publicar un comentario