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
Post a Comment