Dronky

Rounding solution

Feb 2nd, 2016
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. package ca_2;
  2. import java.util.Scanner;
  3. public class CA_2
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner s = new Scanner(System.in);
  8.         int size = s.nextInt();
  9.         for (int i = 0; i < size; i++)
  10.         {
  11.           System.out.print(lampaDel(s.nextInt(),s.nextInt())+" ");
  12.         }
  13.     }
  14.     public static int lampaDel(double a,double b)
  15.     {
  16.            int c = (int)((a/b)+0.5);
  17.            if (c<0) return c-1;
  18.            else return c;
  19.     }
  20. }
Add Comment
Please, Sign In to add comment