Plesae correct my code please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
20th Jul 2017, 2:11 PM
Samrat Tayade
Samrat Tayade - avatar
5 Answers
+ 2
No entirely sure what you want to achieve, but you need to initialize your variables to use them in loops (Assign your integers to actual numbers). I've made a modification of the script here: https://code.sololearn.com/cWxKU9nxZGF0 Where I make n = input and initialize j and i inside the for loops.
20th Jul 2017, 2:24 PM
Frederik Stenberg
Frederik Stenberg - avatar
+ 1
enter no. for prints stars
20th Jul 2017, 2:25 PM
Samrat Tayade
Samrat Tayade - avatar
0
What is your code suppose to do? The error you are getting, with this code is: 'variable n might not have been initialized' So, you need to initialize the variable n, before you can use it. Meaning, before your first for-loop, you should assign a value to the variable n. fx.: 'n = ro;'. Hope this helps.
20th Jul 2017, 2:23 PM
Jan Dickow
Jan Dickow - avatar
0
you cont initilize n value
20th Jul 2017, 3:23 PM
ch.chitti srilakshmi
ch.chitti srilakshmi - avatar
0
give n a value when you initialize it int n=3; the problem is your for loop trying to use n for(int i=0; i<n; i++)
20th Jul 2017, 4:48 PM
S C