Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C- program (to be called \"a21.cmm\") that reads in two values (x and y)

ID: 440513 • Letter: W

Question

Write a C- program (to be called "a21.cmm") that reads in two values (x and y) and that calculates and outputs xy (i.e. x to the y th power). The value entered for y must be an integer. If it is not your program should just output an error message (and not do anything else). In C-function isInt can be used to determine whether or not a value is an integer (as shown below) if (isInt(k)) { // if we get here k is an integer ... } // endif Apart from islnt, you may NOT make use of any functions (and in particular you are NOT permitted to use function pow). Instead the required value must be obtained by repeated multiplication. Both x and y may be less than zero, equal to zero, or greater than zero. Your program must be able to deal with all possible combinations. If an answer cannot be calculated your program should output an error message instead. Hint: Use your solution (or the sample solution) from assignment #1 question #4 to help you.

Explanation / Answer

#include int check(int num) { if (num >0 || num=0) { for(int i =1;i=y;i--) val = val/((float)x); } printf("Value of %d & %d = %f",x,y,val); } else printf(" Error "); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote