pablosotol

Clase 2

Mar 16th, 2016
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. public class Prueba1{
  2.        private boolean band;
  3.        int anioActual=2016;
  4.      
  5.        public boolean isBisiesto(int anioActual){
  6.               if(anioActual%4==0 && anioActual%100!=0 || anioActual%400==0){
  7.                  band=true;
  8.                  }else{
  9.                           band=false;
  10.                     }
  11.                           return band;                    
  12. }
  13.              
  14.     public void anioBisiesto(){
  15.            int cont=0;
  16.            while(cont<20){
  17.                 if(isBisiesto(anioActual)){
  18.                    cont++;
  19.                    System.out.println(anioActual);                  
  20.                 }
  21.                    anioActual=anioActual-1;
  22. }
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment