Advertisement
Guest User

#1/3

a guest
Mar 30th, 2017
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. package com.company;
  2. import java.util.*;
  3.  
  4. public class Main {
  5.  
  6.     public static void main (String[] args){
  7.  
  8.         int[] arr = {12, 3, 48, 133, 88};
  9.         Scanner in = new Scanner(System.in);
  10.         int input = 0;
  11.  
  12.         String arout = Arrays.toString(arr);
  13.         System.out.println("Счет с нуля.");
  14.         System.out.println(arout);
  15.         System.out.println("Введите  id : ");
  16.         input = in.nextInt();
  17.  
  18.         System.out.println(" Увеличено - " + sum(arr, input));
  19.     }
  20.  
  21.     public static double sum(int arr[], int input ){
  22.  
  23.         double ar = arr[input];
  24.         double total = 0;
  25.         double buf = 0;
  26.  
  27.         //input 2
  28.         buf = ar / 100;//48 / 100 = 0.48
  29.         buf = buf * 10;//0.48 * 10 = 4.8
  30.         total = ar + buf;
  31.  
  32.         return total;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement