bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / R / Code / R_Code-11.r

R_Code-11.r (401B)


      1 # Write a while loop that starts with a multiplier of 1. 
      2 # The loop should multiply the current multiplier by 4, 
      3 # assign it to a result variable, and print the result. 
      4 # The loop should exit if the result exceeds 100; otherwise, 
      5 # increment the multiplier by 1. 
      6 
      7 num = 1 
      8 while(TRUE) {
      9     result <- num * 4
     10     print(result)
     11     
     12     if (result > 100) {
     13         break
     14     }
     15     num = num + 1
     16 }