SHARE
TWEET

For Eugen

Hellman228 Jun 1st, 2020 627 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main {
  2.     public static void main(String[] args) {
  3.         double [] array = new double[10];
  4.         int first = 0,second = 0;
  5.         double sum = 0;
  6.         for(int i = 0; i<array.length; i++)
  7.         {
  8.             array[i] = Math.random()*20 - 10;
  9.             if(array[i] > 0 && first == 0){
  10.                 first = i;
  11.             }
  12.             else if(array[i] > 0 && first != i && second == 0){
  13.                 second = i;
  14.             }
  15.         }
  16.         for(int i = first; i< second; i++){
  17.             sum += array[i];
  18.         }
  19.         System.out.println(sum);
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top