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
Briefly describe a B+ tree. What is bulk loading in it?
Are php strings immutable?
What is the average salary of a c++ programmer?
How did c++ start?
In the derived class, which data member of the base class are visible?
What is the most useful programming language?
Is c++ fully object oriented?
What can I use instead of namespace std?
How do you declare a set in c++?
Is string an object in c++?
What is the history of c++?
Is java as fast as c++?
What is a sequence in c++?
What is the best c++ book for beginners?
Write a program to concatenate two strings.