HOW TO FIND THE SUM 12345 IN JAVA ?


INPUT:-

public class example{

public static void main(String args[]){

int i,sum=0;

for(i=1;i<=5;i++){

 sum=i+sum;

}

 System.out.println(sum);

}

}

OUTPUT:-