Here We Are with a simple JAVA program that will print sum of given Integer Elements without Second Variable......
Below is your Program
// @author Aamir khan
// @url aamir-4u.blogspot.com
public class ArrayAdditon {
public static void main(String args[]){
int add[]={1,2,3,4,5,45,67,45,78,89,90};
int i;
for(i=0;i<add.length;i++){
try{
add[i]+=add[i+1];
add[i+1]=add[i];
} catch (Exception e) {
}
}
System.out.println("Total = "+add[add.length-1]);
}
}
Download the Code from here
{ 0 comments... read them below or add one }
Post a Comment
What you Says