Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are the tasks performed by a Team Lead

2787


what is the BAM? where we can use it in BizTalk server?

1750


I m Abdullah Ansari compleated MCA from Jamia Hamdard,i have appeared the test of IBM on 2 august at oxford college of engineering Bangalore.waiting for hr round.. This is the first round for IBM.02/08/08 Paper consists of 4 sections 15 questions from matrices(time very less but no negative marking). 25 questions from series completion section (this section is very easy but negative marking) 15 questions from aptitude(little bit tough time limit 15 minute negative marking) 4th section is from computer science (c,c++,operating system,digital electronics ,basic question..) result came at 3 o'clock.i was selected... In interview they asked questions like 1 they asked about final yr project.. 2 what are dynamic and static memory location? 3 linked list and array difference between them. 4 what is function ? what is difference betwen function and inline function? 5 about structure 6 about binary tree, traversal, call by value. 7 storage class and many more basic questions..

3250


Display names and numbers of employees who have 5 years or more experience and  salary less than Rs.15000 using array of structures (name, number, experience and  salary)

4694


How do i find out the number of parameters passed into function?

2596


if 3 duplicate records, by keeping one original and one duplicate record, and how to delete remaining 2 duplicates in sql server 2008

2095


qtp 9.2 14 days demo version was expired.I uninstalled how to reinstall this again

2727


Given a set. Write the pseudo code to get all the subsets for the given set. Eg. Input : {1,2} Output : (),(1),(2),(1,2)

2629


What is the difference beween joblib and steplib statements

2215


I am looking for selenium RC online Training in chennai. can any one tell me the best institute

1915


Q1.Write a C program which asks the user for a number between 1 to 9 and shows the  number. If the user inputs a number out of the specified range, the program should  show an error and prompt the user for a valid input.

2655


hi i am jyoti i have done sap training in sd and master degree in economics have 2 year exp as enduser in (gdms)and 1 year as sd consultant.as contract basis now what i can do for getting job in it industry

2079


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?

1878


I want to insert date in the form of yyyy-mm-dd... if any changes happen while inserting date format want to show error meg...any one can solve this..??

2048


how many types of bytes are there???

2492