grodek118

Falling Distance

Feb 5th, 2023
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static final double G_POWER = 9.8;
  4.  
  5.     public static void main(String[] args)
  6.     {
  7.         int time = 1;
  8.  
  9.         for (int i = 0; i <= 10; i++)
  10.         {
  11.             System.out.println(fallingDistance(time));
  12.             time++;
  13.         }
  14.     }
  15.  
  16.     public static double fallingDistance(int time)
  17.     {
  18.         return G_POWER * Math.pow(time, 2) * 1/2;
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment