TO CALCULATE x(y+z) BY USING USER DEFINED FUNCTION


#include<stdio.h>
void power(int x,int y, int z)
{
int ans = 1, i;
for(i = 1; i <= (y+z); i++)
ans *= x;
printf("%d ^ (%d+%d) = %d",x,y,z,ans);
}


void main()
{
int x,y,z;
printf("Enter value of x: ");
scanf("%d",&x);
printf("Enter value of y: ");
scanf("%d",&y);
printf("Enter value of z: ");
scanf("%d",&z);
power(x,y,z);
}

0 comments: (+add yours?)

Post a Comment