Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Show the declaration for a pointer to function returning long and taking an integer parameter.

1130


What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00

1067


What is the difference between a template and a macro?

1052


Explain the differences between list x; & list x();.

1005


What is a flag in c++?

1055


What is DlgProc?

1024


What are friend classes?

1064


How can you tell what shell you are running on unix system?

1111


Can class objects be passed as function arguments?

1063


Are there interfaces in c++?

996


Define a pdb file.

1071


What is virtual methods?

1119


What are the various arithmetic operators in c++?

1118


What is null pointer and void pointer and what is their use?

1098


How can we access protected and private members of a class?

1114