hi frnds!!

i have d code for series

with single loop only

//wap to find sum of series and print series also
void main()
int n,x,count1;
int sum=0;
cout<<"enter a number";
cout<<"enter nth term till which u want to compute";
int count=1;
for(int i=1;i<=n;i++)
cout<<" "<<"+"<<" ";
cout<<"sum of series is="<<sum;

so enjoy!!
nd give ur comments if u like it...

Where are the code tags???

non-standard function that is normally available only to Turbo C. If you are going to post code snippets that everyone might want to use then don't use non-standard functions like that one.

>>cout<<" "<<"+"<<" ";

You can abbreviate that into a single statement: cout << count << " + "; >>getch();
Don't use that in c++ programs. use cin.get() . This is an old thread, but still relevant.

First void main is a big no no. main should return an int and only an int. Second <iostream.h> is depreciated and should not be used as well. You should use <iostream> . Lastly please use indentation in you code. It makes it much easier to read.

commented: Yes +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.