Computer Science, asked by kamleshsri8790, 9 months ago

Write the output of the following
INPUT "ENTER A NUMBER":N
FOR P=1 TON
S=S+P
PRINT “SUM=";s
NEXT P​

Answers

Answered by lntg
0

Write the output of the following

INPUT "ENTER A NUMBER":N

FOR P=1 TON

S=S+P

PRINT “SUM=";s

NEXT P​

Answered by codiepienagoya
0

The Output of the given Q basic code as follows:

Output:

ENTER A NUMBER:   5

SUM= 1

SUM= 3

SUM= 6

SUM= 10

SUM= 15

Explanation:

In the given code, there is some error so, the correct code to this question can be described as follows:

Program:

INPUT "ENTER A NUMBER: ", N 'defining integer variable n

FOR P=1 TO N 'defining loop to calculate the value

 S=S+P 'add values  

 PRINT "SUM= "; S 'print value

 NEXT P 'increment the value of loop variable

Description of the code:

  • In the given Q basic code, an integer variable "N" is declared, which accepts an integer value from the user end.
  • In the next step, a for loop is declare, in which two integer variable "P and S" is used.
  • The P variable is used in loop count value and S variable is used to add all value, uses the print function to prints it values.

Learn more:

  • Q basic program: https://brainly.in/question/14635240
Similar questions