R_Code-14.r (613B)
1 # Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026 2 # Repo: https://github.com/notamitgamer/bsc 3 # License: MIT 4 5 # Write an if...else if...else block that evaluates a newly created temperature variable. 6 # * If the temperature is strictly greater than 30, print: "30+ is too hot!" 7 # * If the temperature is between 20 and 30 (inclusive), print: "Perfect weather." 8 # * Otherwise, print: "It is quite cold." 9 10 temperature <- 29 11 if(temperature > 30) { 12 print("30+ is too hot!") 13 } else if(temperature >= 20 && temperature <= 30) { 14 print("Perfect weather") 15 } else { 16 print("It is quite cold.") 17 }