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
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).
What is the importance of mutable keyword?
What is an accessor in c++?
What is the purpose of ios::basefield in the following statement?
What are the benefits of operator overloading?
What is a multiset c++?
How much is c++ certification?
Is there structure in c++?
Differentiate between a template class and class template in c++?
What are the general quetions are in DEna bank manager IT/System interviews?
What causes a runtime error c++?
What is the difference between a template and a macro?
What is a local variable?
What is pair in c++?
What are the differences between java and c++?