FY_BCA_C_SLIP_12




/* Slip no : 12_1 write prog to calculate x to the power y without using std function*/

#include<stdio.h>
#include<conio.h>

int main()
{
                int x,y,i,mult=1;
                clrscr();
                printf("\n Enter the value of x and y to calculate power :");
                scanf("%d %d",&x,&y);
                for(i=0;i<y;i++)
                {
                                mult=mult*x;
                }
                printf("\n %d to power %d = %d",x,y,mult);
                getch();
}

No comments:

Post a Comment