Advertisement
davegimo

contatore

Mar 3rd, 2021
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. public class HelloWorld{
  2.  
  3.      public static void main(String []args){
  4.        
  5.         int[] a = {3,5,6,7,1,6,8,11,1000,1,5,5,5342,56,3};
  6.        
  7.         int conta = 0;
  8.        
  9.         for (int i = 0; i < a.length; i++) {
  10.             if (a[i] == 1 ) {
  11.                 conta++;
  12.             }
  13.         }
  14.        
  15.         System.out.println(conta);
  16.        
  17.        
  18.        
  19.      }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement