30 lines
792 B
C++
30 lines
792 B
C++
|
/*
|
||
|
* Let's C Version 4.0.C.
|
||
|
* Copyright (c) 1982-1987 by Mark Williams Company, Chicago.
|
||
|
* All rights reserved. May not be copied or disclosed without permission.
|
||
|
*/
|
||
|
|
||
|
/* This a simple C program that computes the results of three
|
||
|
* different rates of inflation over a span of ten years.
|
||
|
* Use this text file to learn how to use MicroEMACS commands
|
||
|
* to make creating and editing text files fast, efficient, and
|
||
|
* easy.
|
||
|
*/
|
||
|
#include <stdio.h>
|
||
|
main()
|
||
|
{
|
||
|
int i; /* count ten years */
|
||
|
float w1, w2, w3; /* three inflated quantities */
|
||
|
char *msg = " %2d\t%f %f\n"; /* printf string */
|
||
|
i = 0;
|
||
|
w1 = 1.0;
|
||
|
w2 = 1.0;
|
||
|
w3 = 1.0;
|
||
|
for (i = 1; i<= 10; i++) {
|
||
|
w1 *= 1.07; /* apply inflation */
|
||
|
w2 *= 1.08;
|
||
|
w3 *= 1.10;
|
||
|
printf (msg, i, w1, w2, w3);
|
||
|
}
|
||
|
}
|