FY_BCA_C_SLIP_10




/* Slip no : 10_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,z,i,mult=1;
                clrscr();
                printf("\n Enter the value of x and y and z to calculate power :");
                scanf("%d %d %d",&x,&y,&z);
                for(i=0;i<y+z;i++)
                {
                                mult=mult*x;
                }
                printf("\n %d to power %d+%d = %d",x,y,z,mult);
                getch();
}

No comments:

Post a Comment