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
Is swift faster than c++?
How are virtual functions implemented in c++?
What is data hiding c++?
Is c++ high level programming language?
Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list
What is abstraction in c++?
What is a constructor in c++ with example?
What does n mean in c++?
A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
How do I exit turbo c++?
What are the various compound assignment operators in c++?
Can you explicitly call a destructor on a local variable?
What is pointer to member?
Difference between overloading vs. Overriding
What do you mean by volatile and mutable keywords used in c++?