#include<stdio.h> int findexpon(int number, int index) { int expon = 1; for(int i = 1; i <= index; i++) { expon = expon * number; } return expon; } int finfact(int number) { int sum; int fact = 1; for(int i = 1; i <= number; i++) { fact = fact * i ; } return fact; } void main() { int number, fact, index, expon; printf("enter value : "); scanf("%d", &number); printf("enter exponential: "); scanf("%d", &index); expon = findexpon(number, index); fact = finfact(number); if(index > 0) { printf("%d! = %d\n",number, fact); printf("%d^%d = %d", number, index, expon); } else { printf("enter exponential > 0") } }
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