Sum from 1 to n = n*(n+1)/2
100*(100+1)/2
int Total=0; for(i=1;i<=100;i++) { Total=Total+i; } Response.Write("Total = "+Total.ToString());
int i=1; int total=0; while(i<=100) { total=total+i; i++; } response.write("Ans :"+total.ToString());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)