@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$ <dixit.coolfrog.div...@gmail.com
> 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 <aswat...@gmail.com> 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 <
>> dixit.coolfrog.div...@gmail.com> 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 algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>> .
>>> 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 algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> 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 algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to