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
how to add Servlet-api.jar file into eclipse 3.3.2 ?
can any method return type may be constructor , or that method name allow
what is web configuration file
Q2. A memory location has physical address D5687h. Compute: a. The offset address if the segment number is D445h. b. The segment number if the offset address is B577h.
Difference between views and index in sas programming
What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?
It is possible to take number of controls added to form at run-time.ex-when user enter 6, 6 text boxes get added to form,next time number of controls get change as per user number enter. What is code for that?
Difference between delegates and Events?
How do you initialize a static member of a class with return value of some function?
What is test execution and when will we start execution please send me one example for this question
Define distributed queries. can you explain me as soon as possible
what is woransient key word? how it is used in java
Write a shell program. Enter number of days from keyboard. Find out the number of years, month and days it contains
why not instantiating servet using new operator?
which book we learned this mantis? how many version are realsed this mantis upto now?