Produces a table of first 20 squares with while loop - C Statement

C examples for Statement:while

Description

Produces a table of first 20 squares with while loop

Demo Code

#include <stdio.h>
int main(void)
{
    int num = 1;/*from   ww w  .  j  a v a 2  s . c om*/
    
    while (num < 21)
    {
        printf("%4d %6d\n", num, num * num);
        num = num + 1;
    }
    
    return 0;
}

Result


Related Tutorials