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 / ashok ak

#include<iostream>
using namespace std;
int main()
{
int a=0,n;
cout<<"Enter the Number ";
cin>>n;
for(int i=1;i<=n;i++)
a+=pow(i,2);
cout<<"The Sum of Total is "<<a;
return 0;
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does namespace mean in c++?

1078


Can a new be used in place of old mallocq? If yes, why?

1096


What is #include c++?

1136


What is the size of integer variable?

1065


Does c++ have foreach?

1064


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

1230


How do you initialize a string in c++?

1001


What is the full form of dos?

1165


Explain the concept of friend function in c++?

1115


How should a contructor handle a failure?

1192


Do you know the use of vtable?

1136


What is the use of pointer in c++ with example?

1048


Why is c++ is better than c?

981


Explain some examples of operator overloading?

1124


Are there interfaces in c++?

1017