C examples for Statement:for
Generates a table of factorials.
#include <stdio.h> int main (void){ int factorial; printf (" n n! \n"); printf ("----- ----------\n"); factorial = 1;//ww w . j a va 2 s .c o m for (int n = 1; n <= 10; n++ ){ factorial *= n; printf (" %2i %7i \n", n, factorial); } return 0; }