# What is the output of this pseudocode ?Watch

Announcements
#1
How is it 6? I keep getting 5 .
0
1 week ago
#2
Firstly, notice that the value of X never changes, so the value of X remains as 5 throughout the loop. That means the value of Sum only changes when 'C' is a number which yields 5 mod C = 0. (i.e. the remainder of 5 divided by C is zero)

So look at the values of C as the program progresses. notice how 'C' changes each time in the loop.

Obviously 5 mod 1 is zero because 5 divides neatly into 1. It also divides neatly into 5 so 5 mod 5 is also zero.
Last edited by winterscoming; 1 week ago
0
#3
(Original post by winterscoming)
Firstly, notice that the value of X never changes, so the value of X remains as 5 throughout the loop. That means the value of Sum only changes when 'C' is a number which yields 5 mod C = 0. (i.e. the remainder of 5 divided by C is zero)

So look at the values of C as the program progresses. notice how 'C' changes each time in the loop.

Obviously 5 mod 1 is zero because 5 divides neatly into 1. It also divides neatly into 5 so 5 mod 5 is also zero.
Thank youu
1
X

new posts
Back
to top
Latest
My Feed

### Oops, nobody has postedin the last few hours.

Why not re-start the conversation?

see more

### See more of what you like onThe Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

### University open days

• Cardiff Metropolitan University
Sat, 19 Oct '19
• Coventry University
Sat, 19 Oct '19
• University of Birmingham
Sat, 19 Oct '19

### Poll

Join the discussion

#### Why wouldn't you turn to teachers if you were being bullied?

They might tell my parents (26)
6.9%
They might tell the bully (38)
10.08%
I don't think they'd understand (58)
15.38%
It might lead to more bullying (146)
38.73%
There's nothing they could do (109)
28.91%