Linggo, Pebrero 12, 2012

basic act 8 : array . negative or positive



package javaapplication5;




public class JavaApplication5 {


   
    public static void main(String[] args) {
     int j = 9;
     int val[] = {1, 2, 3, 4, 5, 6, 7};
      
        for (int i = 0; i < val.length; i++) {
            
                    j -= val[i];
            
        }
        
        if(j >= 0){
            System.out.println("jolly");
        }        else
            System.out.println("not jolly");
    }
}

Walang komento:

Mag-post ng isang Komento