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
What do c++ programmers do?
Explain differences between alloc() and free()?
What is the best book for c++ beginners?
What is the difference between structure and class?
Is atoi safe?
Which bit wise operator is suitable for turning off a particular bit in a number?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create
Why is it necessary to use a reference in the argument to the copy constructor?
Differentiate between an inspector and a mutator ?
What is purpose of abstract class?
Should I learn c or c++ or c#?
How do you clear a set in c++?
What c++ is used for?
Can you sort a set c++?
Explain the concept of memory leak?