C examples for Statement:for
Generate a table of squared numbers.
#include <stdio.h> int main (void) { int n;/*from w ww. j av a 2 s . c o m*/ printf (" n n^2 \n"); printf ("----- -----\n"); for ( n = 1; n < 11; n++ ) { printf (" %2i %3i \n", n, n * n); } return 0; }