-
Description [Please, leave a feedback when you complete it or this will always stay in beta and you will not earn language points].
Print all numbers up to
3rd
parameter which are multiple of both1st
and2nd
paramater.Code for i in $(eval echo {1..$3}); do if [ `expr $i % $1` -eq 0 -a `expr $i % $2` -eq 0 ] then echo $i fi done
Test Cases output = run_shell args: [3,4,120] describe "Solution" do it "should return proper results for 3,4,120" do expect(output).to include("12\r\n24\r\n36\r\n48\r\n60\r\n72\r\n84\r\n96\r\n108\r\n120") end end output2 = run_shell args: [2,7,85] describe "Solution" do it "should return proper results for 2,7,85" do expect(output2).to include("14\r\n28\r\n42\r\n56\r\n70\r\n84") end end output3 = run_shell args: [14,15,185] describe "Solution" do it "should return proper results for 14,15,185" do expect(output3).to include("") end end output4 = run_shell args: [14,17,480] describe "Solution" do it "should return proper results for 14,17,480" do expect(output4).to include("238\r\n476") end end output5 = run_shell args: [2,5,90] describe "Solution" do it "should return proper results for 2,5,90" do expect(output5).to include("10\r\n20\r\n30\r\n40\r\n50\r\n60\r\n70\r\n80\r\n90") end end output6 = run_shell args: [4,7,97] describe "Solution" do it "should return proper results for 4,7,97" do expect(output6).to include("28\r\n56\r\n84") end end
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}