public class HackDefence{
public static void main(String[]args){
int sum = 0;
int array[] = {78,95,34,76};
for(int counter = 0; counter<array.length;counter++){ //array.length gives length of array
sum+=array[counter];
}
System.out.println("Sum of elemnets of array:" + sum);
}
}
OUTPUT:
Great work finally i got this
ReplyDeleteLearn Hacking step by step in URDU