Q: Write a C program to accept information about 4 cars. We consider the program with two-dimensional array “database”, where each row is an individual car, while columns represent parameters of a vehicle
Main function should perform the following tasks.
Read the type of vehicle, engine size, mileage, year, and price from the user and stores it in 2 dimensional “database” array.
Prints list of cars from “database” with ID, year and price as follows
ID# Year Price 1 2005 130000 2 2002 140000 3 2004 150000 4 2001 160000
#include<stdio.h>
int main() {
int i, j, count = 0;
char database[4][5];
printf("Please enter body type, engine size, mileage, year, and price of car # %d\n", count++);
for(i=0; i<4; i++) {
for(j=4;j<5;j++) {
scanf("%s", i+1, &database[i][j]);
}
}
printf("\n<<<<<<\nList of cars available on a lot>>>>>>\n");
printf("\nID#\t\tYear\t\tPrice\n");
for(i=0; i<4; i++) {
for(j=4;j<5;j++) {
printf("%d\t\t%s\t\t\n", i+1, &database[i][j]);
}
}
return 0;
}
Not working