Evaluate Y=Xˆn

13. write a program to evaluate Y=Xˆn?
#include
#include
void main()
{
int Y=1,X,n,i=i;
clrscr();
printf("enter two numbers");
scanf("%d%d",&X&n);
while(i<=n)
{
Y=Y*X;
i++;
}
printf("%d',Y);
getch();
}

Algorithum
1.start
2.enter the values of X and n
3.check
4.calculate Y=Y*i
5.print the value of Y
6.stop


Result

The program is sucessfully executed and desired output is obtained

Output
Enter the two numbers 4 4
256


0 comments:

Post a Comment