Find the distance covered to collect items at equal distances | Java program to calculate the distance for given problem ; function to calculate the distance ; Driver program
class demo { public static int find_distance ( int n ) { return n * ( 3 * n + 7 ) ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . print ( " Distance ▁ = ▁ " ) ; System . out . println ( find_distance ( n ) ) ; } }