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 is lambda in c++?

1135


What is a storage class?

1195


What is constructor in C++?

1024


What is conditions when using boolean operators?

1151


What is tellg () in c++?

1248


How can we access protected and private members of a class?

1068


Tell me difference between constant pointer and pointer to a constant.

1125


What is a float in c++?

940


Should you pass exceptions by value or by reference?

1094


What are the extraction and insertion operators in c++? Explain with examples.

1112


How long it will take to learn c++?

1008


What are the new features that iso/ansi c++ has added to original c++ specifications?

1079


Explain differences between new() and delete()?

1060


What is abstraction c++?

951


What is searching? Explain linear and binary search.

954