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 remove header and footer in jcl using sort utility
In JCl , we have COND parameter.This holds comparison code and condition.It also has only and even parameters. ex: COND((4,GE),EVEN).what the comma mean here. is that 'and' or 'or'.
will it allow to add same value in HashMap class.
hoe to data grid use in sql server 2000?
Hai, My name is nisha.I have NIC exam.If anybody Knows NIC previous paper pattern pls send me to nishanairp@gmail.com
You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?
what is the last ant version you worked?how to get it
When we use Windows authentication mode
How to change the color of a cell or a row in a datagrid on mouse hover using javascript/.net
In an customer exit (include Z) program, only the last record is getting fetched. The exit is getting called after pressing save button. What to write for fetching the first record ? Before saved to a SAP table how can i call all these records in an itab in the exit ?
how pseudo column works?
Which CRM is better to opt, Sebiel CRM or Salesforce CRM or sap CRM? which institute is best one in hyderabad
Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.
purpose of abstraction and interface
5.Call by value and Call by reference with program?