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

How does atoi function work?

1110


What is the use of seekg in c++?

1001


Why use of template is better than a base class?

1118


What is function declaration in c++ with example?

1018


Can member data be public?

1005


What does h mean in maths?

1123


What is split a string in c++?

1140


What is the purpose of ios::basefield in the following statement?

1207


Differentiate between the manipulator and setf( ) function?

1113


What are the various operations performed on stack?

1046


What is the copy-and-swap idiom?

1060


Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

3797


How does java differ from c and c++?

937


What are c++ manipulators?

1015


the maximum length of a character constant can be a) 2 b) 1 c) 8

1048