Created
          February 13, 2014 05:13 
        
      - 
      
- 
        Save pepet96/8970096 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.util.Scanner; | |
| public class unlucky{ | |
| public static void main(String [] args) | |
| { | |
| Scanner input = new Scanner (System.in); | |
| int params = input.nextInt(); | |
| int[] arr = new int[params]; | |
| for(int i = 0 ; i < arr.length ; i++){ | |
| arr[i] = input.nextInt(); | |
| } | |
| int fin = sum(arr); | |
| System.out.println(fin); | |
| } | |
| public static int sum(int[] arr){ | |
| int sum = 0; | |
| if(arr.length == 0){ | |
| sum = 0; | |
| } | |
| else{ | |
| for(int i = 0 ; i < arr.length ; i++) | |
| { | |
| if( arr[i] == 13) | |
| { | |
| arr[i] = 0; | |
| } else { | |
| sum = sum + arr[i]; | |
| } | |
| } | |
| } | |
| return sum; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment