write a program to check whether the given number was of the form 3^n. ( i.e. 3 to the power n).

Wednesday, February 3, 2010

//find wheather a number is in the form of 3pow(n)
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<math.h>
void recur(int);
int i=1,n;
void main()
{       clrscr();
      //    extern int n;
    cout<<"enter the number: ";
    cin>>n;
    recur(3);

}
void recur(int x)
{       if(x==n)
    {    cout<<"number is multiple";
        getch();
        exit(0);
    }
    if(x>n)
    {    cout<<"number is not multiple";
        getch();
        exit(0);
    }
    else
    {       recur(pow(3,++i));
    }
}

2 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...

Making money on the internet is easy in the underground world of [URL=http://www.www.blackhatmoneymaker.com]blackhat forum[/URL], Don’t feel silly if you don't know what blackhat is. Blackhat marketing uses little-known or misunderstood methods to build an income online.