R_Code-11.r ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 20 Mar 2026
- License — MIT
Problem Statement ​
Problem Statement
Write a while loop that starts with a multiplier of 1. The loop should multiply the current multiplier by 4, assign it to a result variable, and print the result. The loop should exit if the result exceeds 100; otherwise, increment the multiplier by 1.
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
r
# Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 20 Mar 2026
# Repo: https://github.com/notamitgamer/bsc
# License: MIT
# Write a while loop that starts with a multiplier of 1.
# The loop should multiply the current multiplier by 4,
# assign it to a result variable, and print the result.
# The loop should exit if the result exceeds 100; otherwise,
# increment the multiplier by 1.
num = 1
while(TRUE) {
result <- num * 4
print(result)
if (result > 100) {
break
}
num = num + 1
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20