C examples for Statement:for
Prints first-class postage rates using for loop
#include <stdio.h> int main(void) { const int FIRST_OZ = 46; // 2013 rate const int NEXT_OZ = 20; // 2013 rate int ounces, cost; /*from w ww. ja v a 2 s .com*/ printf(" ounces cost\n"); for (ounces=1, cost=FIRST_OZ; ounces <= 16; ounces++, cost += NEXT_OZ) printf("%5d $%4.2f\n", ounces, cost/100.0); return 0; }