Using a for loop to make a table of cubes - C Statement

C examples for Statement:for

Description

Using a for loop to make a table of cubes

Demo Code

#include <stdio.h>
int main(void)
{
    int num;//  w  w  w  .  j  av  a 2 s.  c om
    
    printf("    n   n cubed\n");
    for (num = 1; num <= 6; num++)
        printf("%5d %5d\n", num, num*num*num);
    
    return 0;
}

Result


Related Tutorials