Reorder the code to declare a Queue of integers, add values 1 through 5 and print the contents of the Queue. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Reorder the code to declare a Queue of integers, add values 1 through 5 and print the contents of the Queue.

1 q.Enqueue(x); 2 for (int x = 1; x <= 5; x++) 3 Console.Write(val + " "); 4 foreach (int val in q) 5 Queue<int> q = new Queue<int>();

8th Oct 2019, 10:54 AM
Atharva mali
Atharva mali - avatar
2 Réponses
+ 3
Answer: 1 Queue<int> q = new Queue<int>(); 2 for (int x = 1; x <= 5; x++) 3 q.Enqueue(x); 4 foreach (int val in q) 5 Console.Write(val + " ");
27th Mar 2021, 5:18 PM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
0
Are you asking or giving task. If you are giving task to do it then please this is not the right place for such type of things. Please check this once. https://www.sololearn.com/discuss/1316935/?ref=app
8th Oct 2019, 11:31 AM
A͢J
A͢J - avatar