Friday, September 13, 2019

Power of a to b (@function call)

#include <stdio.h>
int power(int,int);
int r;
main()
{  
int a,b;
printf("you are finding a power b\n");

printf("enter in form of ' a space b' \n");
scanf("%d%d",&a,&b);
power(a,b);
printf("%d",r);
}

power(int a,int b)
{ int i;

r=1;
for(i=1;i<=b;i++)
{  r=r*a;  }
return r;
}

No comments:

Implement stsStr Leetcode solution

  28.   Implement strStr() Easy Implement  strStr() . Given two strings  needle  and  haystack , return the index of the first occurrence of...