Session Ready
Exercise

Using variables 1

What is the sum of the first \(n\) positive integers?

We can use the formula \( n(n+1)/2 \) to quickly compute this quantity.

Instructions
100 XP
  • Define n<-100
  • Then use R to compute the sum of 1 through 100 using the formula \( n(n+1)/2\). What is the sum?
  • Make sure you do not erase or change the sample code on DataCamp exercises.