OCJP

Define Power Using C language

#include<stdio.h>
#include<conio.h>
void main()
{
int x,n,i;
long p=1;
clrscr();
   printf("\nEnter the value of x :");
   scanf("\n%d",&x);
   printf("\nEnter the value of y :");
   scanf("\n%d",&n);
   i=1;
   while(i<=n)
   {
   p=p*x;
   i++;
   }
   printf("\npower = %d ",p);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *


× How can I help you?