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 c++program for this condition
1+4+9+16+….+100

Like this (1^2+2^2)

Hint use function pow(a,b)

Answer Posted / chaithanya kumar

#include<iostream>
#include<math.h>
using namespace std;
main()
{
double j=0,l=0;
double k=0;
int max,i;

cout<<"enter a maximum value"<<endl;
cin>>max;
for(i=1;i<=max;i++)
{
j=pow(i,2);
j=j+k;
k=j;
}
cout<<"value is j= "<<j<<endl;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Briefly describe a B+ tree. What is bulk loading in it?

1341


Are php strings immutable?

1053


What is the average salary of a c++ programmer?

1021


How did c++ start?

1090


In the derived class, which data member of the base class are visible?

1116


What is the most useful programming language?

1051


Is c++ fully object oriented?

973


What can I use instead of namespace std?

1156


How do you declare a set in c++?

954


Is string an object in c++?

1154


What is the history of c++?

1081


Is java as fast as c++?

1105


What is a sequence in c++?

1017


What is the best c++ book for beginners?

1150


Write a program to concatenate two strings.

1094