0

STEP 1: START STEP 2: SET size = 4 STEP 3: SET r = size. REPEAT STEP 4 to 9 until r !=0 STEP 4: SET s=0. REPEAT STEP 5 UNTIL s<(

How to write coding from this algorithm

1st Nov 2020, 10:21 PM
Moon Scarlet
Moon Scarlet - avatar
3 ответов
+ 1
size=4 r=4 while(r!=0){ s=0 while(s<(size-r)){ console.write("**") s=s+1 } t=0 while(t<2*r-1){ Console.write("*") t=t+1 } Console.writeline() r=r-1 } i haven't tested but just an assumption based on what it should look like as asked in code
1st Nov 2020, 10:46 PM
Abhay
Abhay - avatar
0
continue that question STEP 1: START STEP 2: SET size = 4 STEP 3: SET r = size. REPEAT STEP 4 to 9 until r !=0 STEP 4: SET s=0. REPEAT STEP 5 UNTIL s<(size – r) STEP 5: PRINT ** and SET s=s+1 STEP 6: SET t=0. REPEAT STEP 7 UNTIL t< (2*r – 1) STEP 7: PRINT * and SET t=t+1 STEP 8: PRINT new line STEP 9: SET r=r-1 STEP 10: END
1st Nov 2020, 10:21 PM
Moon Scarlet
Moon Scarlet - avatar
0
I think you mean while instead of until, otherwise it produces no output. This smells like a homework assignment and you should probably do it yourself to learn something but anyway here you go https://code.sololearn.com/cwmQ2W8ah4yr/?ref=app
1st Nov 2020, 11:27 PM
Benjamin Jürgens
Benjamin Jürgens - avatar