C examples for Statement:for
Generates a table of triangular numbers.
#include <stdio.h> int main (void) { int n;//from ww w. ja v a 2 s .co m printf (" n t \n"); printf ("----- -------\n"); for (n = 5; n <= 50 ; n = n + 5) { printf(" %2i %4i \n", n, n * (n + 1) / 2); } return 0; }