ARRAY PLAY USING FOR LOOP IN JAVA
public class Main
{
public static void main(String[] args) {
int arr[]={1,3,45,56};
int sum = 0 ;
for(int i=0; i<4; i++)
{
//System.out.println(arr[i]);
sum = sum+(arr[i]);
System.out.println(sum);
}
}
}
public class Main
{
public static void main(String[] args) {
int arr[]={1,3,45,56};
int sum = 0 ;
for(int i=0; i<4; i++)
{
//System.out.println(arr[i]);
sum = sum+(arr[i]);
System.out.println(sum);
}
}
}
Comments
Post a Comment