home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day08
/
expenses.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-04-26
|
573b
|
29 lines
/* expenses.c - Demonstrates use of an array */
#include <stdio.h>
/* Declare an array to hold expenses, and a counter variable */
float expenses[13];
int count;
int main( void )
{
/* Input data from keyboard into array */
for (count = 1; count < 13; count++)
{
printf("Enter expenses for month %d: ", count);
scanf("%f", &expenses[count]);
}
/* Print array contents */
for (count = 1; count < 13; count++)
{
printf("Month %d = $%.2f\n", count, expenses[count]);
}
return 0;
}