Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Exercice 12
- n=100
- x=1
- for (i in 1:n)
- {
- x=x+i
- }
- print(x)#5051
- # Exercice 13
- n=1
- x=0
- while (n<100)
- {
- x = x + n
- n = n + 1
- }
- print(x)
- print(sum(1:100))
- # Exercice 14
- # Conjecture de Syracuse
- x=41
- while(x>1)
- {
- if (x%%2 == 0)
- {
- x = x / 2
- }
- else
- {
- x = 3 * x + 1
- }
- print(x)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement