0
How do i change an int value to a specific number in C#?
Why can't you just do this? int number = 1; Console.WriteLine(number); number = 2; Console.WriteLine(number); number = 3; Console.WriteLine(number);
5 Respuestas
+ 4
Well, you can do this. What are you trying to do? What issues are you encountering?
0
It says a local variable " " is already defined
0
Where did you define it? Please link your complete code.
0
int RanNum =(Convert.ToInt32(Console.ReadLine()));
int RanNum2 =(Convert.ToInt32(Console.ReadLine()));
Random rd = new Random();
int rand_num = rd.Next(RanNum,RanNum2);
int rand_num = rd.Next(RanNum,RanNum2);
int rand_num = rd.Next(RanNum,RanNum2);
int rand_num = rd.Next(RanNum,RanNum2);
int rand_num = rd.Next(RanNum,RanNum2);
Console.WriteLine(rand_num);
Console.WriteLine(rand_num);
Console.WriteLine(rand_num);
Console.WriteLine(rand_num);
Console.WriteLine(rand_num);
0
Is this the code mentioned in the description?
You defined
int rand_num
multiple times.
Initialize rand_num ONCE. Then use it: Sample a number, print the number, sample a new number...