Question: Using only the techniques you learned in this chapter, write a program that calculates the squares and cubes of the numbers from 0 to 10 and uses tabs to print the following table of values:
1 2 |
/* <br /> * Author: AGHATISE OSAZUWA<br /> * Website: www.cscprogrammingtutorials.com<br /> *<br /> * Program to calculate the squares and square roots of numbers from 0 to 10.<br /> *<br /> */<br /><br />#include <stdio.h><br />int main ( ){ <br /> printf("numbertsquaretcuben");<br /> printf("%dt%dt%dn", 0, 0*0, 0*0*0);<br /> printf("%dt%dt%dn", 1, 1*1, 1*1*1);<br /> printf("%dt%dt%dn", 2, 2*2, 2*2*2);<br /> printf("%dt%dt%dn", 3, 3*3, 3*3*3);<br /> printf("%dt%dt%dn", 4, 4*4, 4*4*4);<br /> printf("%dt%dt%dn", 5, 5*5, 5*5*5);<br /> printf("%dt%dt%dn", 6, 6*6, 6*6*6);<br /> printf("%dt%dt%dn", 7, 7*7, 7*7*7);<br /> printf("%dt%dt%dn", 8, 8*8, 8*8*8);<br /> printf("%dt%dt%dn", 9, 9*9, 9*9*9);<br /> printf("%dt%dt%dn", 10, 10*10, 10*10*10);<br /> return 0;<br />}<br /> |
Click here to see other solutions to Deitel C How To Program exercises.