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
In a function declaration what does extern means?
Why we use #include conio h in c++?
Why should you learn c++?
Is c++ vector dynamic?
How a new operator differs from the operator new?
What is the difference between function overloading and operator overloading?
What things would you remember while making an interface?
What does iomanip mean in c++?
How do you establish an is-a relationship?
What is the use of setprecision in c++?
What is a rooted hierarchy?
Differentiate between C and C++.
What is the difference between mutex and binary semaphore?
How do you differentiate between overloading the prefix and postfix increments?
Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.