Sunday, 24 December 2017

C Program to find result of power of a number

#include<stdio.h>
int main( )
{
   int n, pow, i, j=1;

  printf("Enter the number and its power");

  scanf("%d %d",&n,&pow);

  if(pow==0)

     printf("Result is 1");

  for(i=1; i<=pow; i++)

    {
       j=j*n;
    }

  if(pow>0)

    printf("Result is %d",j);

return 0;


}



  

No comments:

Post a Comment

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...