Read array element one by one and output array elements - C Array

C examples for Array:Array Value

Description

Read array element one by one and output array elements

Demo Code

#include <stdio.h>

int main( void )
{
    float expenses[13];
    /*from  w w w .  j av a2s. c  om*/
    int count;
    
    for (count = 1; count < 13; count++){
        printf("Enter expenses for month %d: ", count);
        scanf("%f", &expenses[count]);
    }

    for (count = 1; count < 13; count++){
        printf("Month %d = $%.2f\n", count, expenses[count]);
    }
    return 0;
}

Result


Related Tutorials