Code:
public class SumOfArray{
public static void main(String args[])
{
int[] array = {10, 20, 30, 40, 50, 10};
int sum = 0;
for( int num : array)
{
sum = sum+num;
}
System.out.println("Sum of array elements is:"+sum);
}
}
Hey Guys !This blog has all my Java Programs that I have made either for practice or to know the Programs asked or can be asked in Interviews. All these programs of mine have been tested on the Eclipse -JEE-Luna-SR2 using JAVA SE Development kit and they all work fine. These program codes are here to help you all and remember.If you have any Suggestions or Queries, please do comment below.
No comments:
Post a Comment