Leah.J
Badges: 13
Rep:
?
#1
Report Thread starter 1 week ago
#1
How is it 6? I keep getting 5 .
Name:  Screenshot (10).png
Views: 3
Size:  54.2 KB
0
reply
winterscoming
Badges: 19
Rep:
?
#2
Report 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
reply
Leah.J
Badges: 13
Rep:
?
#3
Report Thread starter 1 week ago
#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
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

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

Personalise

University open days

  • Cardiff Metropolitan University
    Undergraduate Open Day - Llandaff Campus Undergraduate
    Sat, 19 Oct '19
  • Coventry University
    Undergraduate Open Day Undergraduate
    Sat, 19 Oct '19
  • University of Birmingham
    Undergraduate Open Day Undergraduate
    Sat, 19 Oct '19

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%

Watched Threads

View All