Tuesday, 7 April 2015

C Program to calculate X raised to Y without using Standard Library Functions.

#include<stdio.h>
#include<conio.h>
main()
{
                int x,x1,y,i=1,a=1;
                clrscr();
                printf("Enter values for base x and power y :\n");
                scanf("%d%d",&x,&y);
                x1=x;
                while(i<=y)
                {
                                a=a*x;
                                i++;
                }
                printf("\n%d raised to %d is %d",x1,y,a);
}

No comments:

Post a Comment