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 / sumitpalsingh

public class Power {

public static void main(String[] args) {
int b=2;
for(int i=1;i<=10;i++)
{
System.out.println(Math.pow(i,b));
}


}

}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can i split string in a textbox in windows appication using C#.net

2433


3. What is the difference between testing and Quality Assurance?

1679


hai i am prasanna.I am MCA 2009 fresher.tell me about certifications.which certification helps me to improve my carrier and to get a technically oriented job ,which certification helps to get job faster.

2207


Please describe an example where you used object orientation in one of your programs.

1690


What sysoption determines where the macro facility searches a specific catalog for complied macro?

1877


1.Mutating table

1615


hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.

1611


can we allocate memory for interface? if no then why?

1648


what are other resources are needed for this mantis?

1715


iam confused among testing ,.net and java. can anybody help me.

1776


how do you generate source code for the automatic generation for receipt number

4193


WS-NUM PIC S9(05)V(02) SIGN TRAILING SEPARATE MOVE '0050000+' TO WS-NUM The value stored is 00500,00+ MOVE '0050000-' TO WS-NUM Then what is the value will be stored in WS-NUM? Am getting '-00500,00'.....>>> What should I declare to WS-NUM so that I can get correct values for both + & - signs.

2031


what is integration testing in real time applications?

2084


Difference between HTML and DHTML?

1861


What is the entry point function of a DLL?

795