Hi ALL,
Here I wrote a program for Adding Value to Array Using Java.
package Arrays;
/**
*
* @author Balamurugan
M
*/
public class Array1 {
public static void
main(String arg[]){
int[] num=new
int[5];
for(int
i=1;i<num.length;i++){
num[i]=i+num[i-1];
}
num[0]=num[1]+num[4];
for(int j=0;
j<num.length;j++)
System.out.println("array value "+num[j]);
}
}
No comments:
Post a Comment