+ 1
How can i use a loop for acces an array,or run an array
JavaScript
6 Antworten
+ 4
#include <iostream>
using namespace std;
main() {
int arr[5]={1,2,3,4,5};
for(int i=0;i<5;i++){
cout<<arr[i]<<endl;
}
}
+ 4
Elements of array will be printed.
+ 1
thanks
+ 1
// in java:
public class Loop
{
public static void main(String[] args) {
int[] arr = {1,2,3,4,5,6,7};
for (int i : arr) {
System.out.println(i);
}
}
}
0
so what's gonna be the exact output of that your code
0
ahh k