@coolfrog$
I think this can match ur requirements not even indirect recursion
#include<iostream>
using namespace std;
static int i;
class sample
{
public:
sample()
{
i=i+1;
cout<<i<<"\n";
}
};
main()
{
int n;
cout<<"Enter n"<<"\n";
cin>>n;
sample s[n];
return 0;
}
tats it....
On Thu, Sep 23, 2010 at 11:29 PM, coolfrog$ <[email protected]
> wrote:
> @aswath :
> nice solution... very simple too.....
> it gives the desired solution as required..though it is a case of indirect
> recursion... but still a nice aproach...
> keep it up....
> thanks.
> Regards
> Divesh....
>
> On Thu, Sep 23, 2010 at 12:45 PM, aswath G B <[email protected]> wrote:
>
>> #include<stdio.h>
>> void f1(int);
>> void f2(int);
>> int val;
>> main()
>> {
>> printf("Enter number\n");
>> scanf("%d",&val);
>> f1(1);
>> return 0;
>> }
>> void f1(int m)
>> {
>> if(m <= val)
>> {
>> printf("%d\n",m);
>> m++;
>> f2(m);
>> }
>> }
>> void f2(int n)
>> {
>> if(n <= val)
>> {
>> printf("%d\n",n);
>> n++;
>> f1(n);
>> }
>> }
>>
>> I think this prog is correct....
>> which satisfies ur requirements....
>>
>> On Wed, Sep 22, 2010 at 9:19 PM, Divesh Dixit <
>> [email protected]> wrote:
>>
>>> Write an algorithm that will print 1 to n, one per each line on the
>>> standard output, where n is
>>> a integer parameter to the algorithm. An algorithm should not use
>>> while, for, do-while
>>> loops, goto statement, recursion, and switch statement.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<algogeeks%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<algogeeks%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
http://aswath78.blogspot.com
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.