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

Write a function square() that takes an integer and return its square, and a fun

ID: 3529787 • Letter: W

Question

Write a function square() that takes an integer and return its square, and a function cube() that takes an integer and return its cube. Use your square() and cube() functions to write the functions quartic() and quintic(), which return the fourth and fifth powers of an integer, respectively. Use your functions to write a program that prints a table of powers of integers from 1 to 25. The output of your program should look like this: A TABLE OF POWERS ------------- INTEGER SQUARE CUBE QUARTIC QUINTIC ------- ------ ---- ------- ------- 1 1 1 1 1 2 4 8 16 32 3 9 27 81 243 4 16 64 256 1024 5 25 125 625 3125 6 36 216 1296 7776 7 49 343 2401 16807 8 64 512 4096 32768 9 81 729 6561 59049 10 100 1000 10000 100000 11 121 1331 14641 161051 12 144 1728 20736 248832 13 169 2197 28561 371293 14 196 2744 38416 537824 15 225 3375 50625 759375 16 256 4096 65536 1048576 17 289 4913 83521 1419857 18 324 5832 104976 1889568 19 361 6859 130321 2476099 20 400 8000 160000 3200000 21 441 9261 194481 4084101 22 484 10648 234256 5153632 23 529 12167 279841 6436343 24 576 13824 331776 7962624 25 625 15625 390625 9765625 Except for main function, you have to implement four other functions. Square() and cube() must be invoked in quartic() and quintic() functions.

Explanation / Answer

//Please rate


#include<stdio.h>


int square(int i){

return i*i;

}


int cube(int i){

return i*square(i);


}



int quartic(int i){

return square(square(i));

}


int quintic(int i){

return cube(i)*square(i);

}



int main(){

int i;



printf("A TABLE OF POWERS ------------- INTEGER SQUARE CUBE QUARTIC QUINTIC ------- ------ ---- ------- ------- ");

for(i=1;i<=25;i++){

printf("%d %d %d %d %d ",i,square(i),cube(i),quartic(i),quintic(i));


}



}

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