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
You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)
what are the 3 forms of a prolog term
how do find the user exit for selected feild whatis the process and can u plz explain it
in network security,how we identified threat?some one say we found threat according to it's signature,but how we get signature or pattern of the virus?
< No Frames > tag is used for
what is woransient key word? how it is used in java
how pseudo column works?
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.
how sap is different from other software ?
which worker is involved in all the phases of SDLC?
Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage
what is the difference between rename and label
how to convert infix expression to prefix expression?
what is the software to run the GSM gate opener program
What is the merger sort principle and its time complexity.