Loops (Missing) Flashcards
1
Q
How do you make a for loop without an array of numbers?
A
```java
public class main{
public static void Main(String[] args){ for (int i = 0; i < 10; i++){ System.out.println(i) } }
}
~~~
2
Q
How do you make a for loop using an array?
A
```java
public class main{
public static void main(String[] args){ int[] numArr = {1,2,3,4,5}; for(int num : numArr){ System.out.println(num) } }
}
~~~
3
Q
How do you make a while loop?
A
```java
public class Main {
public static void main(String[] args) {
int i = 0;
while (i < 10) {
System.out.println(i);
i++;
}
}
}
~~~