In the 1st place your for loop structure was wrong so it won't compile. you can use for(i=1 ;i<=10 ; ) but not for(i=1;i<=10) . Unless ur using the enhanced for loop which is there from java 1.5 onwards but that also uses a colon ( : ) not a semi-colon. And y r u proceeding to print i without incrementing it ?!. Which will only print the same value again and again rt ?!.Regarding your case it seems u simply want to have a summtion of squares from 1 to 10 right ?!. which mens (1^2)+(2^2)+(3^2)+....rt ?!(i.e : 1+4+9+16+25+..etc rt?). ^ stand for square root in java. In that case in could be done like the following :
class s
{
public static void main(String args[])
{
int tot =0;
int square=0;
for (int i=1; i<=10; )
{
square=(i*i);
System.out.println("The Current Square Root Calculated is : "+square);
i+=1;
tot+= square;
}
System.out.println("End of Loop Total Value of Summation is : "+tot);
}
}
If this is not what u want or if ur not clear about anything pls let me know I'll be more than happy to help out
!!.
class s
{
public static void main(String args[])
{
int tot =0;
int square=0;
for (int i=1; i<=10; )
{
square=(i*i);
System.out.println("The Current Square Root Calculated is : "+square);
i+=1;
tot+= square;
}
System.out.println("End of Loop Total Value of Summation is : "+tot);
}
}
If this is not what u want or if ur not clear about anything pls let me know I'll be more than happy to help out
mata nan davas 3n kela vela inne man kalin mukuthma karala ne
studiesui javai jam vela inne
have to study more about this