Write a C program, called power of three.c, that prompts the user to input a pos
ID: 3623136 • Letter: W
Question
Write a C program, called power of three.c, that prompts the user to input a positive integer, and then checks whether this integer is a power of 3. If the input is, indeed, equal to 3^n for some non-negative integer n (for example 1 = 3^0, 81 = 3^4, or 129140163 = 3^17), the program should tell the user that the input is a power of 3 and print the exponent n. If the input is a positive integer which is not a power of 3, the program should print a corresponding message. Finally, if the input is an integer lessthan 1, the program should terminate with an appropriate error message. Here are sample runs of the program!
Enter a positive integer: 81
81 is a power of 3, exponent = 4
Enter a positive integer: 1
1 is a power of 3, exponent = 0
Enter a positive integer: 12
12 is not a power of 3!