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

What is expression parser in c++

2509


How will you call C functions from C ++ and vice-versa?

1147


Explain deep copy and a shallow copy?

1072


What is a storage class? Mention the storage classes in c++.

1026


Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.

1048


What is the difference between an external iterator and an internal iterator?

1111


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

1201


Why do we learn c++?

978


What is class and structure in c++?

1183


Write a function to find the nth item from the end of a linked list in a single pass.

983


Differences between private, protected and public and give examples.

1072


Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.

1061


What are virtual constructors/destructors?

1029


How can I learn dev c++ programming?

1065


Why c++ is called oop?

1132