Need the c code please, also please only use <stdio.h> library. Simple code plea
ID: 3766670 • Letter: N
Question
Need the c code please, also please only use <stdio.h> library. Simple code please
Define a struct with teg Capacitor that holds the following Information about a capacitor: Model number (e.g. 11-123U), capacitance (e.g. 1000 u.f), voltage (e.g. 2.5 V), cost {$6.50} Create your main program file capacltorsInfac. Declare two variables of type struct Capacitor and populate them with the following values: First' variable: model Is 11-123U, capacitance Is 100, voltage Is 25 and cost Is $6.00 Second variable: model Is 65T91a, capacitance Is 22000, voltage Is 20 and cost Is $25.00 Print the model number of the first capacitor and the voltage of the Second. Add a third Capacitor variable and Initialize It from values entered by the user. Declare an array of Capacitors of size 4 and copy the three capacitors you. Created to the array. Populate the fourth element of the array from user Input. Add a function dlsplayCapacltorlnfo that takes a capacitor as Input parameter and prints Its details In the following format:Explanation / Answer
#include<stdio.h>
#include<conio.h>
struct Capacitor
{
char Model_num[10];
int capacitance;
float voltage;
float cost;
};
void displayCapacitorInfo(struct Capacitor c)
{
printf("Capacitor: %s",c.Model_num);
printf("Capacitance: %d",c.capacitance);
printf("voltage: %f",c.voltage);
printf("Cost: %s",c.cost);
}
void main()
{
struct Capacitor a,b;
struct Capacitor c;
strcpy(a.Model_num,"11-123U");
a.capacitance=100;
a.voltage=25;
a.cost=6.00;
strcpy(b.Model_num,"65T91a");
b.capacitance=22000;
b.voltage=20;
b.cost=25.00;
printf("Model number=%s",a.Model_num);
printf("Voltage =%f",b.voltage);
printf("Enter Model number");
scanf("%s",&c.Model_num);
printf("Enter Capacitance");
scanf("%d",&c.capacitance);
printf("Enter Voltage:");
scanf("%s",&c.voltage);
printf("Enter Cost:");
scanf("%s",&c.cost);
displayCapacitorInfo(b);
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.