Find the distance covered to collect items at equal distances | C ++ program to calculate the distance for given problem ; function to calculate the distance ; Driver program
#include <bits/stdc++.h> NEW_LINE using namespace std ; int find_distance ( int n ) { return n * ( ( 3 * n ) + 7 ) ; } int main ( ) { int n = 5 ; cout << " Distance ▁ = ▁ " << find_distance ( n ) ; return 0 ; }