Int array
<HTML>
<HEAD>
<TITLE>My First JSP</TITLE>
</HEAD>
<BODY>
<H1>Using the if Statement</H1>
<%
int array[] = {1, 2, 3, 4, 5}, sum = 0;
for (int i = 0;
i < array.length;
sum += array[i++]);
out.println("The average = " + sum / array.length);
%>
</BODY>
</HTML>
Related examples in the same category