Sunday, December 9, 2012

WAP to find X power without using Power Function 34


#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf

void main()
{


long int x,n,i,ans;
clrscr();

p("\nEnter Value of X...");
s("%ld",&x);
p("\nEnter Power Value...");
s("%ld",&n);

ans=x;

for(i=1;i<n;i++)
{
x=x*ans;
}

p("\nEntered Value is...%ld\nYour Power is...%ld\nAnswer is...%ld\n",ans,n,x);
p("\n\n\tpress any key for exit...");

getch();

}

No comments:

Post a Comment