It should be obvious by now that this exercise requires SOME type of looping. Recursion is just a different way of looping.

Whether the looping works with the program code, (in whatever logic), the operating system, or even the underlying hardware, it makes no difference in terms of the logic. You can either write out the individual increments, one by one, or you will use some type of looping.

It's a great exercise for fun perhaps, but as far as teaching you something about C, it has minimal benefit, imo.


class shareef
static int a;
int main()
int n;
cout<<Enter given range:"
shareef *p;
p=new shareef[n];
delete p;
return 0;

I hope this will be result.

Votes + Comments
That's C++, genius.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.