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
Why is it called c++?
What is the full form of c++?
Describe private, protected and public – the differences and give examples.
Why would you use pointers in c++?
What is the precedence when there is a global variable and a local variable in the program with the same name?
What are the basic data types used in c++?
What you know about structures in C++?
What is heap sort in c++?
Is java a c++?
Should the member functions which are made public in the base class be hidden?
What is #include ctype h in c++?
What is the function of I/O library in C++ ?
What is static function? Explain with an example
Is multimap sorted c++?
how to explain our contribution in the project?