#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.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to