ู…ุงู‡ูˆ ุงู„ู†ู‚ุต ููŠ ุงู„ code ุญุชู‰ ูŠุนุทูŠ ุงู„ู†ุงุชุฌ ูฃูฆ ูู‚ุทุŸุŸ ูˆุฃุฑูŠุฏ ุฃู† ูŠุฌุฑูŠ ู…ู‚ุฏุงุฑ ุงู„ุฒูŠุงุฏุฉ ุนู„ู‰ ูƒู„ ุนู†ุงุตุฑ ุงู„ู…ุตููˆูุฉ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

ู…ุงู‡ูˆ ุงู„ู†ู‚ุต ููŠ ุงู„ code ุญุชู‰ ูŠุนุทูŠ ุงู„ู†ุงุชุฌ ูฃูฆ ูู‚ุทุŸุŸ ูˆุฃุฑูŠุฏ ุฃู† ูŠุฌุฑูŠ ู…ู‚ุฏุงุฑ ุงู„ุฒูŠุงุฏุฉ ุนู„ู‰ ูƒู„ ุนู†ุงุตุฑ ุงู„ู…ุตููˆูุฉ

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var sum =0; for (var i=0; i<prices.length ;i++) sum +=increase; console.log (sum); }

23rd Jan 2022, 5:10 PM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
20 Answers
+ 6
I believe you can understand English as well. Here, you're adding a same value (increase) with sum for each iteration. But, task says that you need to add the value with price array elements and print the updated array. You can use i as index of array elements and add with increase.
23rd Jan 2022, 5:21 PM
Simba
Simba - avatar
+ 3
Zina Shekh Alzoor Use the following statement instead. for(let i=0; i<prices.length; i++){ sum[i] += increase; console.log(sum[i] ); } edit: for(let i=0; i<prices.length; i++){ prices[i]+= increase; sum+=prices[i]; } console.log(sum);
23rd Jan 2022, 9:27 PM
Mohammed
+ 3
Zina Shekh Alzoor I'm so sorry, I made a mistake, for(let i=0; i<prices.length; i++){ prices[i] += increase; sum+= prices[i]; } console.log(sum);
23rd Jan 2022, 9:49 PM
Mohammed
+ 3
ู„ุฐู„ูƒ ุŒ ูŠู…ูƒู†ูƒ ุทุจุงุนุฉ ุงู„ู…ุตููˆูุฉ ุจุฏู„ุงู‹ ู…ู† ุงู„ุนู†ุงุตุฑ console.log(prices)
24th Jan 2022, 4:43 AM
Simba
Simba - avatar
+ 2
I understand English but weak in it, Do you mean like this? It also didn't work
23rd Jan 2022, 5:31 PM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 2
i[0] +=increase; i[1] +=increase; i[2] +=increase; i[3] +=increase;
23rd Jan 2022, 5:33 PM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 2
Output is Undefined
23rd Jan 2022, 9:44 PM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 2
ู…ุงุฒุงู„ ุงู„ู†ุงุชุฌ ุฎุงุทุฆุŒ ูŠุนุทูŠ ู†ุงุชุฌ ูˆุงุญุฏ ูู‚ุท ุจุฏู„ุง ู…ู† ุฃู† ูŠุฌู…ุน ูƒู„ ุนู†ุตุฑ ู…ุน ู…ู‚ุฏุงุฑ ุงู„ุฒูŠุงุฏุฉ
23rd Jan 2022, 10:04 PM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 2
function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for (let i=0; i<prices.length ;i++) { prices[i]+=increase; } console.log(prices); }
24th Jan 2022, 9:53 AM
Mohammed
+ 1
for(let i=0; i<prices.length; i++) { prices[i]+=increase; console.log(prices[i]); } ู‡ุฐุง ุงู„ุจุฑู†ุงู…ุฌ ูŠุทุจุน ุฌู…ูŠุน ุนู†ุงุตุฑ ุงู„ุณุนุฑ ู…ุน ู…ู‚ุฏุงุฑ ุงู„ุฒูŠุงุฏุฉ.
23rd Jan 2022, 10:10 PM
Mohammed
+ 1
You are working on a Store Manager program, which stores the prices in an array. You need to add functionality to increase the prices by the given amount. The increase variable is taken from user input. You need to increase all the prices in the given array by that amount and output to the console the resulting array.
24th Jan 2022, 9:48 AM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 1
ู‡ุฐุง ุงู„ุณุคุงู„
24th Jan 2022, 9:48 AM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 1
ุดูƒุฑู‹ุง ุฌุฒูŠู„ู‹ุง ู„ูƒ
24th Jan 2022, 9:56 AM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
+ 1
Zina Shekh Alzoor No problem.
24th Jan 2022, 9:56 AM
Mohammed
0
ุฃุนุทู‰ ู†ูุณ ุงู„ุฎุฑุฌ ุงู„ู…ุชูˆู‚ุน ูˆู…ุน ุฐู„ูƒ ูŠุนุทูŠ ุฃู†ู‡ ุฎุฑุฌ ุฎุงุทุฆุŸุŸ!! ู‡ู„ ู…ู…ูƒู† ู„ุงู† ุงู„ุฎุฑุฌ ู†ูุณ ุงู„ุงุฑู‚ุงู… ูˆู„ูƒู† ุจุดูƒู„ ุนู…ูˆุฏูŠ ูˆู‡ู… ูŠุฑูŠุฏูˆู† ุงู„ุฎุฑุฌ ุจุดูƒู„ ุงูู‚ูŠ ูˆู…ุซู„ ุดูƒู„ ุงู„ู…ุตููˆูุฉ!!
23rd Jan 2022, 10:25 PM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
0
ู…ุงุฒุงู„ ูŠุนุทูŠ ุฎุทุฃุŒ ู„ุฃู†ู‡ ูŠุนุทูŠ 4 ู†ุชุงุฆุฌ ูˆุงู„ุฃุฎูŠุฑุฉ ูู‚ุท ูƒุงู„ู†ุชูŠุฌุฉ ุงู„ู…ุชูˆู‚ุนุฉ
24th Jan 2022, 8:42 AM
Zina Shekh Alzoor
Zina Shekh Alzoor - avatar
0
Zina Shekh Alzoor ู…ุง ู‡ูˆ ุงู„ุณุคุงู„ ุจุงู„ูƒุงู…ู„ ุŸ
24th Jan 2022, 9:32 AM
Mohammed
0
ู…ุงู‡ูˆ ุงู„ู†ู‚ุต ููŠ ุงู„ code ุญุชู‰ ูŠุนุทูŠ ุงู„ู†ุงุชุฌ ูฃูฆ ูู‚ุทุŸุŸ ูˆุฃุฑูŠุฏ ุฃู† ูŠุฌุฑูŠ ู…ู‚ุฏุงุฑ ุงู„ุฒูŠุงุฏุฉ ุนู„ู‰ ูƒู„ ุนู†ุงุตุฑ ุงู„ู…ุตููˆูุฉ function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var sum =0; for (var i=0; i<prices.length ;i++) sum +=increase; console.log (sum); }
24th Jan 2022, 6:26 PM
Swati Singh
Swati Singh - avatar
0
function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for (var i=0;i<prices.length;i++){ prices[i] += increase; } console.log(prices); } ุฅุณุชุนู…ู„ ู‡ุฐุง ุงู„ูƒูˆุฏ ุงู„ุฎู„ู„ ุงู„ูˆุญูŠุฏ ุงู„ุฐูŠ ููŠ ุชู„ูƒ ุงู„ุฃูƒูˆุงุฏ ู‡ูˆ ู…ูƒุงู† console.log.
25th Jan 2022, 1:34 PM
DarkHollow
DarkHollow - avatar
25th Jan 2022, 4:48 PM
Techno.uae
Techno.uae - avatar