शुरू करेंमुफ़्त में शुरू करें

Simulate the factorable probability

Now we will use the is_factorable function that we wrote in the previous exercise to check factorability of many quadratics.

Specifically, we will check every combination of a, b and c where each value is between 1 and 100, using a nested for loop.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Probability Puzzles in R

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Write a nested for loop, to loop each of a, b, and c from the values 1 through 100.
  • For each combination of a, b and c, check whether the quadratic is factorable.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

counter <- 0

# Nested for loop
for(___){
  for(___){
    for(___){
      # Check whether factorable
      if(___){
        counter <- counter + 1
      }
    }
  }
}

print(counter / 100^3)
कोड संपादित करें और चलाएँ