Skip to main content

'k' th power of 'n' - ( n ^ k )

#include <stdio.h> int main() { int n, k, result; printf("Enter the value of n : "); scanf("%d" , &n ); printf("\nEnter the value of k : "); scanf("%d" , &k ); printf("\n"); result = n; for(int i = 1 ; i < k; i++ ) { result = result * n; } printf("%d ^ %d is %d", n, k, result); }




Comments