how can i create an application that generates eight digit integar numbers 5000 times, can i use for loop or while loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how can i create an application that generates eight digit integar numbers 5000 times, can i use for loop or while loop?

password generator

28th Jan 2017, 3:09 PM
Ѧмєєя Нѧмӡѧ
Ѧмєєя Нѧмӡѧ - avatar
5 Answers
+ 2
For loop will be better since it already has an increment part to keep count. for(int x=0; x<=5000; x++) { //your code }
28th Jan 2017, 5:15 PM
Jafca
Jafca - avatar
+ 2
The code in the body is similar to @seamiki. Random rnd = new Random(); int randomNumber; for(int x=0; x<=5000; x++) { randomNumber = rnd.Next(10000000,100000000); //do something with randomNumber }
28th Jan 2017, 11:27 PM
Jafca
Jafca - avatar
0
for(int i=0, i<5000; i++){ int genNumber = random(10000000, 99999999); } it's not c# but the concept is same
28th Jan 2017, 5:17 PM
seamiki
seamiki - avatar
0
jafca if condition is true it will execute the same code 5000 times that is increment in loop header not in body just give me an idea to write that code in body,
28th Jan 2017, 5:21 PM
Ѧмєєя Нѧмӡѧ
Ѧмєєя Нѧмӡѧ - avatar
0
thanks bro i will try
29th Jan 2017, 3:06 AM
Ѧмєєя Нѧмӡѧ
Ѧмєєя Нѧмӡѧ - avatar