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 is the best c++ ide?
What are the unique features of C++.
What is &x in c++?
How do you find out if a linked-list has an end? (I.e. The list is not a cycle)
What is binary search in c++?
What does I ++ mean in c++?
Can user-defined object be declared as static data member of another class?
What is a set in c++?
Can you please explain the difference between overloading and overriding?
What are signs of manipulation?
What flag means?
Define stacks. Provide an example where they are useful.
What are the differences between java and c++?
Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?