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 lambda in c++?
What is a storage class?
What is constructor in C++?
What is conditions when using boolean operators?
What is tellg () in c++?
How can we access protected and private members of a class?
Tell me difference between constant pointer and pointer to a constant.
What is a float in c++?
Should you pass exceptions by value or by reference?
What are the extraction and insertion operators in c++? Explain with examples.
How long it will take to learn c++?
What are the new features that iso/ansi c++ has added to original c++ specifications?
Explain differences between new() and delete()?
What is abstraction c++?
What is searching? Explain linear and binary search.