#include<stdio.h> #include<conio.h> int main(){ int power(int ,int); int result; int a,b; printf("Plz., enter a number: "); scanf("%d",&a); printf("Plz., enter power of the number: "); scanf("%d",&b); result = power(a,b); printf("%d to the power of %d is: %d",a,b,result); } int power(int a,int b) { int i,j,result; result = a; for ( i = 1; i <= b; i++){ if(i != 1) { a = result*a; } } return(a); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter