postgres:
image: postgres
restart: unless-stopped
tty: true
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: data
ports:
- "5432:5432"
volumes:
- ./docker/postgres:/var/lib/postgresql/data
networks:
- laravel
DB_CONNECTION=pgsql
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=data
DB_USERNAME=root
DB_PASSWORD=root
public class LoopWithStep {
int res = getSum(5, 10);
public static int getSum(int n, int step) {
int result = 0;
for (int i = 0; i <= n; i = i + step) {
result += i;
}
return result;
}
}