Computer Science, asked by teenadhamot79, 16 days ago

Write an array declaration in QBasic to create an array that can store marks of 5 students.​

Answers

Answered by nishanikumari23
2

Answer:

Let's consider a requirement, where we want to store marks of 5 students of integer type, then array declare would be: int marks[5];

Explanation:

please mark me as brainlist

Answered by SanviNavodayan
2

Answer:

Array is a variable which stores different values of the same data type. It is useful to organize multiple variables. To declare an array DIM (dimension) statement is used. Lets take an example to declare an array.

DIM numbers(10)

Here DIM is a keyword to declare array, similarly ‘numbers’ is a name of array. If you want to create a string array variable then you need to add dollar ($) at the end of the name of array variable. 10 inside the parentheses means this array can hold 11 elements, yes 11 elements there is a first index array 0 also (0 to 10), but it can store only number value because ‘numbers’ is a numerical variable. Lets see simple example of array in QBASIC.

Example 1:

CLS DIM num(5) num(0) = 2 num(1) = 4 num(2) = 5 num(3) = 10 num(4) = 6 num(5) = 9 PRINT num(0); num(1); num(2); num(3); num(4); num(5) PRINT num(3) + num(5) END

Output:

2 4 5 10 6 9 19

Example 2:

We can take data in array from the user by using looping statement. Following program will take 5 numbers from the users and print the sum of numbers.

CLS DIM num(4) sum = 0 PRINT "Enter any 5 numbers" FOR i = 0 TO 4 INPUT " :: "; num(i) sum = sum + num(i)

NEXT i PRINT "The Sum = "; sum END

Explanation:

एक बार कहा था उन्होंने मुझसे ....

"देखना एक दिन इन्हीं तारों पे तुम्हारा नाम लिख दूंगा "

पता नहीं शायद तारों ने ही इंकार कर दिया...

इसीलिए तो शायद मेरा नाम उस आसमान पे लिखने के लिए उन्हें खुद एक तारा बनना पड़ा....

☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆

Similar questions