Write a program to calculate the following
i want a Java program for this condition
1+4+9+16+….+100

Like this (1^2+2^2)

Hint use function pow(a,b)

Answer Posted / mahavishnu

class Demo{
void check()
{
int a=0;
for(int i=1;i<=10;i++)
{
int b=i*i;
a=a+b;
System.out.println(a);
}
}
}
public class Newdemo
{
public static void main(String[] args)
{
Demo d=new Demo();
d.check();
}
}

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is radio button? Plz show code this! how will select radio buttons to go next window Forms? Supose o radio button1 o radio button2 o radio button3 o radio button4 how will coding this? Plz explain this!

3102


hi viewers, tell me,what is scripting and programming, define and difference...pls

1730


how we can know the funcions available in a class recording java?

1966


what does mean and stack mean in genral programming?

1651


what is web service in java? have u use before.

1848


Hi Guys, This is Rama, right now I am working as a Software Test Engineer in Gurgoan and I have over all 3 years of testing expoeriance. Right now I am looking for a change. Can any body help me out to find a job in south india. Thanks in Advance

1650


4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?

2118


what is dot net framework

2562


Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren?t present.

848


What is Negative testing?

1701


Why did you ever become involved in QA/testing?

1801


kindly send interview materials

1486


Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.

852


how do u handle table control inbdc explain the process in steps iwant the answer in urgent please forward this even i know how to explain there

1970


what do u mean by tagging

1812