Computer Science, asked by n164012, 7 months ago

​Write a QBASIC program to find perimeter of 10 squares using FOR NEXT loop. The loop shall end if the side of the square entered by the user is negative.​​

Answers

Answered by anindyaadhikari13
10

Question:-

Write a QBASIC program to find the perimeter of squares using for next loop. The loop shall end if the side of the square entered by use is negative.

QBASIC Program:-

CLS

FOR I=1 TO 2 STEP 0

INPUT "ENTER THE SIDE OF THE SQUARE: ";A

IF A>=0

S=4*A

PRINT " PERIMETER IS: "+S

ELSE

END

END IF

NEXT I

First of all, we will create an infinity loop and then we will ask the user to input the side of the square. If the side is negative then the program will terminate.

Answered by Jasleen0599
0

A QBASIC program to find perimeter of 10 squares using FOR NEXT loop

from math import sqrt

s='/'.join(input()for x in range(10))

print('\n'.join(s[i:i+int(round(sqrt(len(s))))]for i in range(0,len(s)+1,int(round(sqrt(len(s)))))))

  • loop is a sequence of instructions that is repeated until a certain condition is reached. loops are used to execute a set of statements repeatedly until a particular condition is satisfied, QBasic programming language provides the following types of loops to handle looping requirements.
  • As long as the continuation condition is true, three repetition statements/looping statements provided by Java allow programmers to control the execution flow by repeatedly executing a group of instructions. The looping statements called for, while, and do are three. although statements

#SPJ2

Similar questions