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
Give an example of run-time polymorphism/virtual functions.
What are the various compound assignment operators in c++?
What is the purpose of template?
what are the iterator and generic algorithms.
What are the advantages of prototyping?
Who calls main function?
What is the best free c++ compiler for windows?
what do you mean by volatile variable?
Explain the auto storage classes in c++.
How do I exit turbo c++?
Is it possible to provide special behavior for one instance of a template but not for other instances?
How can you specify a class in C++?
Is it possible to use a new for the reallocation of pointers ?
What is the difference between interpreters and compilers?
What is the use of cmath in c++?