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 / yogeshwaran

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

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

Is This Answer Correct ?    42 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How long will it take to learn programming?

1104


What are the general quetions are in DEna bank manager IT/System interviews?

2064


What is purpose of abstract class?

1127


How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?

1327


What are function prototypes?

1294


Which function should be used to free the memory allocated by calloc()?

1067


Are c and c++ different?

1029


What are the four partitions in which c++ compiler divides the ram?

1286


What are the uses of static class data?

1240


Describe linked list using C++ with an example.

1124


What is the role of copy constructor in copying of thrown objects?

1117


When should overload new operator on a global basis or a class basis?

1137


What do manipulators do?

1067


What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0

1002


What is isdigit c++?

1157