how can i add the last value to the current value using loop..?
i tried so much but didn't find the answer :(

void main(void)
{
int numbers,add,sec;
clrscr ();
for (numbers=1;numbers<=49;numbers++)
	{
	for (sec=numbers;sec<=numbers;sec=numbers+sec)
	printf ("%d ",sec);
	}
getch();
}

here the loop is from 1 to 50, i want the output as like this,
1,3,6,10,15 and so on...

example:
(current number + the number before current number)

1,
2+1=3,
3+3=6,
4+6=10,
5+10=15
6+15=21
7+21=28

i had done it myself, thanks

Be a part of the DaniWeb community

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