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
What is the oldest programming language?
Explain what happens when a pointer is deleted twice?
List different attributes in C++?
Where are setjmp and longjmp used in c++?
What do you mean by early binding?
What is the identity function in c++? How is it useful?
Which is the best c++ software?
How to defines the function in c++?
Program to check whether a word is a sub-string or not of a string typed
How can a called function determine the number of arguments that have been passed to it?
What is the maximum combined length of command line arguments including the space between adjacent arguments?
What's c++ used for?
Explain the difference between overloading and overriding?
What's the best free c++ profiler for windows?
Explain how the virtual base class is different from the conventional base classes of the opps.