+ 1

How can i use a loop for acces an array,or run an array

JavaScript

18th Sep 2018, 10:48 PM
tabe Kyrian
tabe Kyrian - avatar
6 Respostas
+ 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; } }
18th Sep 2018, 11:12 PM
Michael
Michael - avatar
+ 4
Elements of array will be printed.
18th Sep 2018, 11:15 PM
Michael
Michael - avatar
+ 1
thanks
18th Sep 2018, 11:13 PM
tabe Kyrian
tabe Kyrian - avatar
+ 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); } } }
18th Sep 2018, 11:54 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
0
so what's gonna be the exact output of that your code
18th Sep 2018, 11:15 PM
tabe Kyrian
tabe Kyrian - avatar
0
ahh k
18th Sep 2018, 11:16 PM
tabe Kyrian
tabe Kyrian - avatar