Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

ñèñòåìà ñ÷èñëåíèÿ, äèðåêòèâà, DVD, ñåðâèñ, file, label, set, pascal, ÷àñòîòà, object, private, îïåðàòîð âåòâëåíèÿ, class, computer, FAT, assembler, game
 

for valuable work you must have JavaScript (allow active content)

JSP. D.3. Nest of tasks. JSP. JSTL:Core. Tags (c:set), (c:forEach), (c:out)

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.1     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:forEach var="k" begin="1" end="2">
    <c:out value="${k}"/><br>
</c:forEach>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.2     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:forEach var="k" begin="3" end="5">
    <c:out value="${k}"/><br>
</c:forEach>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.3     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:forEach var="k" begin="-1" end="2">
    <c:out value="${k}"/><br>
</c:forEach>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.4     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.5     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="3">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.6     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="2" end="3">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.7     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="3" end="5">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.8     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="3">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="6">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.9     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="1">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="3">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.10     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="3">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="1">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.11     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+2}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+3}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.12     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="4">
    <c:set var="xx" value="${xx+1}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx-1}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.13     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="0"/>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx+i}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="3">
    <c:set var="xx" value="${xx+i}"/>
</c:forEach>
<c:out value="${xx}"/>

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

D.3.14     Answer      Pascal-analogue

We have a code's fragment of JSP-page. Determine a sequence of numbers produced by this code


<c:set var="xx" value="1"/>
<c:forEach var="i" begin="1" end="2">
    <c:set var="xx" value="${xx*i}"/>
</c:forEach>
<c:forEach var="i" begin="1" end="3">
    <c:set var="xx" value="${xx*i}"/>
</c:forEach>
<c:out value="${xx}"/>

 

©   Aliaksandr Prykhodzka    1993 - 2007