I haven't given any return for power function. But I'm getting an output of y+1 !!!Code:#include<stdio.h> int power(int,int); main() { int x,y,o=1; while(o==1) { printf("\nEnter the 2 desired numbers : "); scanf("%d%d",&x,&y); printf("\nThe answer is %d.\n",power(x,y)); printf("\nWant another one ?\n1.Yes\n2.No\n"); scanf("%d",&o); } } int power(int a,int b) { int i,res=1; for(i=1;i<=b;i++) { res=res*a; } }
Why is this happening ?