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
What are vectors used for in c++?
What does flush do c++?
Write a short code using c++ to print out all odd number from 1 to 100 using a for loop
Write about all the implicit member functions of a class?
What is the difference between interpreters and compilers?
What do you understand by zombie objects in c++?
What is java and c++?
What is a tuple c++?
What do you mean by friend class & friend function in c++?
Is c++ proprietary?
What is meaning of in c++?
How can I learn c++ easily?
What is the purpose of templates in c++?
What is std :: flush?
Explain the pure virtual functions?