How to print 1 to 100 counting and sum all of that?


INPUT:-


public class example{
public static void main(String args[]){

int i, sum=0;
for(i=1;i<=100;i++){
   System.out.println(i + " + " );
   sum=sum+i;
}
  System.out.println("=" + sum);
}
}


OUTPUT:-