Almacena el nombre de 5 productos en una matriz de caracteres y sus respectivos precios en un vector paralelo de tipo float. Muestra cuantos productos tienen un precio mayor al primer producto ingresado (se debe contar)
#include <stdio.h> #include <string.h> int main() { float sum = 0; char product[5][20]; float price[5]; int count = 0; for (int i=0; i<5; i++){ printf("Enter product name: "); scanf("%s", product[i]); printf("Enter price: "); scanf("%f", &price[i]); } for (int i=0; i<5; i++){ if(price[i] > price[0]){ count++; sum += price[i]; } } printf("Products higher than %s are: %d\n", product[0], count); printf("Sum of all of them: %f", sum); return 0; }