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 / b sohan lal
#include<iostream.h>
void main()
{
init i,n,k,sum;
clrscr();
sum=0;
cout<<"enter the max limit:";
cin>>n;
i=1;
while(k<=n)
{
k=i*2;
sum=sum+k;
i++;
}
cout<<"result="<<sum;
getch();
}
| Is This Answer Correct ? | 6 Yes | 10 No |
Post New Answer View All Answers
How the delete operator differs from the delete[]operator?
What are the defining traits of an object-oriented language?
How is modularity introduced in C++?
What are the advantages of using friend classes?
What is == in programming?
Are there any special rules about inlining?
Write about the role of c++ in the tradeoff of safety vs. Usability?
What is setf in c++?
What is istream c++?
How one would use switch in a program?
What is the best book for c++ beginners?
Write about the use of the virtual destructor?
What are the advantages of early binding?
What is while loops?
What is the operator in c++?