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
What is Negative testing?
What is the merger sort principle and its time complexity.
9.Difference between even and odd signals?explain with the diagram?
code for connection from windows forms to sql server
When we have two versions of the dot net installed how does the compiler know which version of DLL it has to select to an application.
What is test execution and when will we start execution please send me one example for this question
1. Consider the following code in our example assembly language: ; an example bit of assembly code ROOT: W FATHER FATHER: W SON1 W SON2 SON1: W NIL W NIL ; ---------------------- SON2: W GRANDSON W NIL GRANDSON: W NIL W NIL NIL = 0 Assemble this code carefully following the two pass model, and show the symbol table at the point marked by the dashed line during each pass.
what are resources in case of Threads
What is abstract Method i want the exact definition and is there any possibility to declare class as abstract without any abstract methods in that class?If it is possible then tell me why and how?
what are importance in problem tracking
what is the use of occurs 10 or (any number) in the internal table declaration with header line.
Is class is a abstract datatype in java?
what is the work of 1tier,2tier,&ntier? Plz Explain it!
How to call dll API sub routine in VB Form.
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.