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

Give an example of run-time polymorphism/virtual functions.

1009


What are the various compound assignment operators in c++?

986


What is the purpose of template?

1116


what are the iterator and generic algorithms.

2176


What are the advantages of prototyping?

1065


Who calls main function?

1120


What is the best free c++ compiler for windows?

1112


what do you mean by volatile variable?

1063


Explain the auto storage classes in c++.

1109


How do I exit turbo c++?

1078


Is it possible to provide special behavior for one instance of a template but not for other instances?

1135


How can you specify a class in C++?

1296


Is it possible to use a new for the reallocation of pointers ?

1066


What is the difference between interpreters and compilers?

1198


What is the use of cmath in c++?

1078