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

purpose of abstraction and interface

1516


How to connect to ms word wit VB ojective is to prepare s/w to generate question paper , selects questions randomly from the ms access , database

2002


Can i please VHDL code for D-Latch with clear input ?? (HINT: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs and Outputs: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;

978


MOV.CB 007H,ADCON1 MOVE.CT 001H,_OPTION_REG_7 MOV.CB 007H,CMCON

1614


Write code to read the records from a file and load any array of size 99?make sure that you take care of all the error conditions?

1564






what is the filters in biztakk server? where it can use?

1640


could u please also write an example of a code that involves instances from an abstract class just as u did for interfaces because u said it could also work which i really doubt. thanks

1617


what is difference between input parameter and output parameter.

4194


How does the type system works when there is interoperability between a COM and .Net, i mean what exactly happens there

1560


what is the difference between Windows application and Unix application?

2149


what is the difference between read the data from table and infotype

2041


what is the diffrence between software and hardware language?

1806


Find out the roles which gives access to all tables in SAP? Thanks in advance.

1552


can any one suggestion me present which course(except java,.net) has huge demand in the market?

1605


10.Define filters,binary to hexadecimal,hexadecimal to decimal?

1505