Concetti Chiave
- The program calculates squares and cubes for numbers from 0 to 10.
- It uses tabulations to format the output into a table with columns for numbers, squares, and cubes.
- Each number's square and cube are calculated using simple arithmetic operations within the printf function.
- Results are printed line by line, showing each number alongside its corresponding square and cube values.
- The main function handles all operations and returns 0 upon successful completion, indicating no errors occurred.
/* * Scrivete un programma che calcoli i quadrati e i cubi dei numeri * da 0 a 10 e utilizzi le tabulazioni per visualizzare la seguente * tabella di valori: * * numero quadrato cubo * 0 0 0 * 1 1 1 * 2 4 8 * 3 9 27 * 4 16 64 * 5 25 125 * 6 36 216 * 7 49 343 * 8 64 512 * 9 81 729 * 10 100 1000 */ #include int main(void) { printf("numero quadrato cubo
"); printf("%d %d %d
", 0, 0*0, 0*0*0); printf("%d %d %d
", 1, 1*1, 1*1*1); printf("%d %d %d
", 2, 2*2, 2*2*2); printf("%d %d %d
", 3, 3*3, 3*3*3); printf("%d %d %d
", 4, 4*4, 4*4*4); printf("%d %d %d
", 5, 5*5, 5*5*5); printf("%d %d %d
", 6, 6*6, 6*6*6); printf("%d %d %d
", 7, 7*7, 7*7*7); printf("%d %d %d
", 8, 8*8, 8*8*8); printf("%d %d %d
", 9, 9*9, 9*9*9); printf("%d %d %d
", 10, 10*10, 10*10*10); return 0; }