#!/usr/bin/perl -w my $n = ; my $sum = 0; for (my $i = 0; $i < $n; $i = $i + 1){ my $val = ; $sum = $sum + $val; } # end for $res = sprintf("%.10f\n",$sum); print $res . '\n';