My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

how to use recursion

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
void f(int);
void main()
{
  clrscr();
  f(5);
  getch();
}
void f(int x)
{ cout<<"hello"<<'\t';
  if(x>0)
  f(x-1);
  cout<<"world"<<'\t';
}

0 comments: