7 days 3 vegetables (2D Arrays)

 #include <stdio.h>

int main() 

{

    float veg[7][3];

    int d, v;


    printf("Enter prices of 3 vegetables for 7 days:\n");

    for(d = 0; d < 7; d++) 

        for(v = 0; v < 3; v++) 

            scanf("%f", &veg[d][v]);


    printf("\nPrices of 3 vegetables for 7 days:\n");

    for(d = 0; d < 7; d++) {

        printf("Day %d: ", d + 1);

        for(v = 0; v < 3; v++) {

            printf("%.2f ", veg[d][v]);

        }

        printf("\n");

    }

}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices