1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

pleaseeee help me in my c++ program!!!!!!

Discussion in 'C++' started by shubhankarmayan, Sep 7, 2010.

  1. shubhankarmayan

    shubhankarmayan New Member

    Joined:
    Sep 7, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    i have been given a series and ihave to find its sum.
    i'm just a beginner so pleese keep ur program simple;

    series is like this;
    2^2 + ( 2^2+ 4^4) + (2^2 + 4^4 + 6^6)....
    take in number of terms from user.
     
  2. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    17
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    Take this and from next time try to do your assignment of your own:-
    Code:
    #include<conio.h>
    #include<iostream.h>
    #include<math.h>
    void main()
    {
    clrscr();
    int n,t=2;
    long int total=0,subtotal;
    cout<<"Enter term :";
    cin>>n;
    cout<<"\n\t";
    for(int i=0;i<n;i++)
    	{
    	cout<<"(";
    	for(int j=0;j<=i;j++)
    		{
    		subtotal=pow((j+1)*2,(j+1)*2);
    		cout<<(j+1)*2<<"^"<<(j+1)*2;
    		if(j<i)
    		cout<<"+";
    		}
    	total+=subtotal;
    	cout<<")";
    	if(i<n-1)
    	cout<<"+";
    	}
    cout<<"\n\n\t"<<total;
    getch();
    }
    
     

Share This Page