The sum of an arithmetic progression in the command line

>

echo off

set /a “x=0”

for /L %g in (1,1,99) do set /a “x+=%g” & echo.

>

Where “FOR /L” :

Syntax

FOR /L %%parameter IN (start,step,end) DO command

Keys
start : The first number;
step : The amount by which the sequence is incremented;
end : The last number;

command : The command to carry out, including any
command-line parameters;

%parameter : A replaceable parameter:
in a batch file use %%G (on the command line %G)

And

SumOfAP

2 thoughts on “The sum of an arithmetic progression in the command line

  1. Pingback: Frei Klavier

Leave a Reply

Your email address will not be published. Required fields are marked *

Please confirm that you're a human

captcha