Computer Science, asked by unknown3839, 1 month ago

Write an algorithm and a java program to print 5 to 1 using for loop​

Answers

Answered by kruthikashetty016
1

Explanation:

STEP 1: START

STEP 2: SET lines=8, i=1,j=1,k=1

STEP 3: REPEAT STEP 4 to 13 UNTIL i is less than lines

STEP 4: SET j=1

STEP 5: REPEAT STEP 6 and 7 UNTIL j is less than or equals to (lines/2)

STEP 6: IF j is equals to i PRINT j

ELSE IF i is greater than 4 and j equals lines-i PRINT j

ELSE PRINT " "

STEP 7: j = j + 1

STEP 8: j = j - 2

STEP 9: REPEAT STEP 10 and 11 UNTIL j is greater than 0

STEP 10: IF j is equals to i PRINT j

ELSE IF i is greater than 4 and j equals lines-i PRINT j

ELSE PRINT " "

STEP 11: j = j - 1

STEP 12: PRINT a new line

STEP 13: i = i + 1

STEP 14: EXIT

Answered by snigdhasen723
4

Answer:

there is a solution for every thing

I am too broken

but if u try to cure it will heal

really believe me

it works

I have gone through this process 3 times

and wht did break your heart sis

Attachments:
Similar questions