Jump to content

Sum of a series: Difference between revisions

Sum of a series in Verilog
(Sum of a series in Asymptote)
(Sum of a series in Verilog)
Line 3,136:
1.64393456668156
</pre>
 
=={{header|Verilog}}==
<syntaxhighlight lang="Verilog">module main;
integer i;
real sum;
initial begin
sum = 0.0;
for(i = 1; i <= 1000; i=i+1) sum = sum + 1.0 / (i * i);
$display(sum);
end
endmodule</syntaxhighlight>
<pre>1.64393</pre>
 
=={{header|V (Vlang)}}==
2,161

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.