Computer Science, asked by raturivaibhav40, 8 months ago

4. Which will be the final value of s, if
n = 5, after the execution of the loop.
static void main(int n)
{
int s=1;
for(int i=n;i>1;i--)
{
SES*i;
}
System.out.println(s);
}​

Answers

Answered by Anonymous
0

Answer:

the final pink Floyd 68kilojoule

Explanation:

please Mark as brainliest and follow

Answered by ArpitMishra506
1

Answer:

120

Explanation:

Let's do a dry run :

s = 1

i=5 (because i=n and n=5)

s=s*i => s=1*5 => s=5

i-- => i=4

Is i>1 , yes

So we will continue the loop

s=s*i => s=5*4 => s=20

i-- => i=3

Is i>1 , yes

So we will continue the loop

s=s*i => s=20*3 => s=60

i-- => i=2

Is i>1 , yes

So we will continue the loop

s=s*i => s=60*2 => s=120

i-- => i=1

Is i>1 , no

So we will stop the loop

So value of s = 120

.

.

.

.

Similar questions