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 / sandeep
public class calc{
public int square(int a)
{
return a*a;
}
public static void main(String args[]){
int i=1,sum=0;
calc obj = new calc();
for(i=1;i<=10;i++)
sum=sum+obj.square(i);
System.out.println("answer ="+sum);
}
}
Is This Answer Correct ? | 8 Yes | 3 No |
Post New Answer View All Answers
which book we learned this mantis? how many version are realsed this mantis upto now?
Explain three modes in which files can be accessed from python program
could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?
how to convert hashmap to arraylist with iteration
When you deliver your C++ headers and C++ library of a class (what all can you change in the class so that application using your class does not need to recompile the code)
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box. eg: 3 box contain stick as:1,1,1. if u take 1 stick from 3rd numbred box you will any how win the match.
which worker is involved in all the phases of SDLC?
kindly send interview materials
Write a program to find whether a given number is prime or not.
What is diffrent between Method and and function in c#
1.what is the vesition managment.
write the a cl program with the following specification A. Accept 2 parameters-date and date type B. if date type is J then convert date to *MDY format C. if date type is M convert date to *JUL format 4.send a program message with the value of converted date Please explain for each with coding?
4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?
How to use string functions in QTP?give some examples
iam confused to choose among testing, .net and java can anybody help me????????