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 / sugumar
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ImprtntPrgrms;
/**
*
* @author user
*/
public class series {
public static void main(String args[]){
int i=1,sum=0;
series obj = new series();
for(i=1;i<=10;i++){
sum=sum+(i*i);
System.out.println("Values="+i*i);
}
System.out.println("Sum"+sum);
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
how can we maintain the previous version scripts to new version.
what is the use of occurs 10 or (any number) in the internal table declaration with header line.
I am work in it aompenei
WHat is execution in manual testing and when will we start execution and what language we use in execution
How to call a C++ function which is compiled with C++ compiler in C code?
One boy has to climb steps. He can climb 1 or 2 steps at a time. Write a function that will returns number of way a boy can climb the steps. Int WaytoSteps(int n) (eg:- suppose number of steps is n=4 ,the function will return 5 (one-one-one-one ,one-one-two, one-two-one-,two-one-one, two-two)
What is the use of Differ interface check box in Ship confirm?
what will we require to build project with the help of oracle
without selecting individually each field in Action Class from jsp,what is the best process to select as many as field at a time automatically from jsp page by using value object class.
How to connect the .accdb database file of microsoft access to the Visual Basic 6.0 forms?
what is client server & server? What r types of Joins? explsin it! which types of indexex in sql server? what is triggers?
If u need any fake experience certificate in software side, contact me at: vikramyadhav@gmail.com
How do i find out the number of parameters passed into function?
what is log files in qtp what is use
For a binary tree with n nodes, How many nodes are there which has got both a parent and a child?