Jump to content

Sum multiples of 3 and 5: Difference between revisions

Sum multiples of 3 and 5 en Verilog
(Added solution for Action!)
(Sum multiples of 3 and 5 en Verilog)
Line 4,309:
233168
</pre>
 
 
=={{header|Verilog}}==
<lang Verilog>module main;
integer i, suma;
initial begin
suma = 0;
for(i = 1; i <= 999; i=i+1)
begin
if(i % 3 == 0) suma = suma + i;
else if(i % 5 == 0) suma = suma + i;
end
$display(suma);
$finish ;
end
endmodule</lang>
 
 
=={{header|Wortel}}==
2,161

edits

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