0

Arrays and nested for loop not working properly

https://code.sololearn.com/cCUArZHM6eOk/?ref=app

11th Dec 2020, 4:02 PM
Anas kayani
Anas kayani - avatar
9 Respuestas
+ 3
The variable "n " in the for loop is not declared and initialized ...
11th Dec 2020, 4:04 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 2
It might be problem with the Scope so declare i globally ...
11th Dec 2020, 4:08 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
you should format your code a little better. it's hard to follow. I got the following output from the input: 0 501 1 1001 Press 0 to open salary account Salary account opened Deposit money atleast 500PKR in your salary account Amount of 501 only is added to your salary account Money in salary account in next 5 months respectively month 4 money 501 month 4 money 501 month 5 money 501 month 4 money 501 month 5 money 501 month 6 money 501 Press 1 to open a savings account Savings account opened Deposit money atleast 1000PKR in your savings account Money in savings account in next 5 months respectively 1021 month 4money10211041 month 4money10411061 month 5money10611081 month 4money10811101 month 5money11011121 month 6money11211141 month 4money11411161 month 5money11611181 month 6money11811201 month 7money12011221 month 4money12211241 month 5money12411261 month 6money12611281 month 7money12811301 month 8money1301 // not sure why you made it so complicated. https://code.sololearn.com/ca13a5A12a17
11th Dec 2020, 7:10 PM
Flash
0
If we replace n by i
11th Dec 2020, 4:06 PM
Anas kayani
Anas kayani - avatar
0
Still loop is not giving regular sequence output
11th Dec 2020, 4:07 PM
Anas kayani
Anas kayani - avatar
0
No i have tried but still same issue
11th Dec 2020, 4:14 PM
Anas kayani
Anas kayani - avatar
0
I want the array to proceed once
12th Dec 2020, 3:42 AM
Anas kayani
Anas kayani - avatar
0
Like 4 5 6 7 8
12th Dec 2020, 3:43 AM
Anas kayani
Anas kayani - avatar
0
And money should be like 1021 1041 1061 1081 1101 Thats all
12th Dec 2020, 3:44 AM
Anas kayani
Anas kayani - avatar