I am trying to write C programming code and output will be as below

but I donno how to get the result analysis part.
help me to add the 2nd part with my code:
here is my code below:
#include <stdio.h>
#define MAX 100
struct studentMarkVariable{
int id;
float marks;
};
void getData(struct studentMarkVariable arrs[]);
void show(struct studentMarkVariable arrs[]);
int main()
{
printf ("####### Marks Analyzer V3.0 ####### \n");
struct studentMarkVariable
arrs[MAX];
getData(arrs);
show(arrs);
return 0;
}
void show( struct studentMarkVariable arrs[]){
int count=0;
do
{
if (arrs[count].id!= -1
&& arrs[count].marks != -1){
printf("%d. %d, %.2f\n",count+1,arrs[count].id ,
arrs[count].marks);}
else return;
count++;
}while(count<5);
}
void getData( struct studentMarkVariable arrs[]){
int count=0;
do
{
printf("Enter student id and marks (eg. 12345 89.5):");
int checker1;
float checker2;
scanf("%d",&checker1);
if (checker1 != -1){
(arrs[count].id)=checker1;
}
else{
arrs[count].id= -1;
return;
}
scanf("%f",&checker2);
if (checker2 != -1){
(arrs[count].marks)= checker2;
}
else { arrs[count].marks= -1;
return;}
count++;
}while(count<5);
}
Program:
#include <stdio.h>
#define MAX 100
//struct to define id and marks
struct studentMarkVariable
{
int id;
float marks;
};
//function prototypes
void getData(struct studentMarkVariable arrs[]);
void show(struct studentMarkVariable arrs[]);
int main()
{
printf ("####### Marks Analyzer V3.0 #######
\n");
struct studentMarkVariable arrs[MAX];
//call the method that read data from user
getData(arrs);
//method that shows analysis
show(arrs);
return 0;
}
//function that takes stict array as parameter and displays thae
analysis
void show( struct studentMarkVariable arrs[])
{
float sum=0, avg, lowestmarks=0,highestmarks=0;
int count=0;
do
{
//if the id and marks are not
-1
if (arrs[count].id!= -1 && arrs[count].marks
!= -1)
{
//print the id
and marks
printf("%d. %d,
%.2f\n",count+1,arrs[count].id , arrs[count].marks);
//get the sum of
marks of all the students
sum =
sum+arrs[count].marks;
//if the marks
are of 1st student set lowest and highes as marks of 1st
student
if(count==0)
{
highestmarks=arrs[count].marks;
lowestmarks=arrs[count].marks;
}
else
{
//compare highestmarks with each students marks
and get the highestmarks
if(arrs[count].marks>highestmarks)
highestmarks=arrs[count].marks;
//compare lowestmarks with each students marks
and get the lowestmarks
if(arrs[count].marks<lowestmarks)
lowestmarks=arrs[count].marks;
}
}
count++;
}while(count<5);
//calculate average
avg=sum/(count-1);
//dispaly results
printf ("\n### result of marks analysis ###
\n");
printf("average: %.2f, highest marks: %.2f, lowest
marks: %.2f",avg,highestmarks,lowestmarks);
}
//method that read students details into structure array
void getData( struct studentMarkVariable arrs[])
{
int count=0;
do
{
printf("Enter student id and marks
(eg. 12345 89.5):");
int checker1;
float checker2;
//read the id, add into array if it
is not -1
scanf("%d",&checker1);
if (checker1 != -1)
{
(arrs[count].id)=checker1;
}
//if -1 is entered exit loop
else
{
arrs[count].id= -1;
return;
}
//read the marks, add into array if
it is not -1
scanf("%f",&checker2);
if (checker2 != -1)
{
(arrs[count].marks)=
checker2;
}
//if -1 is entered exit loop
else
{
arrs[count].marks= -1;
return;
}
count++;
}while(count<5);
}
Outptut:

I am trying to write C programming code and output will be as below but I...
Programming in C: I am trying to modify this linked list to be doubly linked list. I’m also trying to add a print in reverse function. I’m really struggling with how to change the insert function to doubly link the nodes without effecting the alphabetical sorting mechanism. Example of desired output: Enter your choice: 1 to insert an element into the list. 2 to delete an element from the list. 3 to end. ? 1 Enter a character: a The...
I am trying to figure out why my C code is outputting "exited, segmentation fault". The game is supposed to generate 4 random numbers and store them in the "secret" array. Then the user is suppose to guess the secret code. The program also calculates the score of the user's guess. For now, I printed out the random secret code that has been generated, but when the game continues, it will output "exited, segmentation fault". Also, the GetSecretCode function has...
C programming - This is what I have so far but it is not working
correctly. It must contain the function and it also needs a
provision to write output to a file. Can anyone help?
#include <stdio.h> I #include <math.h int main (void) int V float Rint, RLE0, 0; printf New power supply voltage scanf ("td", &V) printf Enter a valid Internal Resistance (Rint) range between 200 and 5k ohms: scanf ("tf", Rint if (V> 1 && VK 15)...
****Using C and only C****
I have some C code that has the function addRecord, to add a
record to a linked list of records. However, when I run it, the
program exits after asking the user to input the address. See
picture below:
Here is my code:
#include<stdio.h>
#include<stdlib.h>
struct record
{
int accountno;
char name[25];
char address[80];
struct record* next;
};
void addRecord(struct record* newRecord) //Function For Adding
Record at last in a SinglyLinkedList
{
struct record *current,*start,*temp;...
In C , checks if the entered password for admin is correct by calling checkAdminPassword. Part of this function has been implemented, complete the statement in if(). Keep in mind that the entered password is plaintext whereas the password in struct user is in the hashsed form. The password for user admin is “s#1Pa5”. int checkAdminPassword(char* password, struct user* users, int count) { for (int i = 0; i < count; ++i) { if (strcmp((users + i)->username, "admin") == 0)...
Hello, I am having trouble with a problem in my C language class. I am trying to make a program with the following requirements: 1. Use #define to define MAX_SIZE1 as 20, and MAX_SIZE2 as 10 2. Use typedef to define the following struct type: struct { char name[MAX_SIZE1]; int scores[MAX_SIZE2]; } 3. The program accepts from the command line an integer n (<= 30) as the number of students in the class. You may assume that the...
I am trying to add a string command to my code. what am i doing wrong? #define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <stdio.h> #include <string.h> #include <math.h> int main(void) { int i, j; int rowA, colA, rowB, colB; int A[10][10], B[10][10]; int sum[10][10]; char str1[10]; printf("This is a matrix calculator\n"); //read in size from user MATRIX A printf("Enter in matrix A....\n"); printf("\t#row = "); scanf("%d", &rowA); printf("\t#col = "); ...
I am trying to change my code so i no longer need the function that reads in the users base and height input but rather uses the implementation of argument vector in C. I want to accept command line arguments and have it calculate my area. so i want to type this into the command line and have it calculate my area project1 5 4 #include <stdio.h> void userDimensions(float *base, float *height) { scanf("%f", base); scanf("%f", height); } float calcArea(float...
C LANGUAGE I just need the void push() function, which inserts new node to the front of the list #include<stdio.h> #include<stdlib.h> typedef struct node { int data; struct node *next; } Node; //Creating head a as a global Node* Node *head; /* Given a node prev_node, insert a new node after the given prev_node */ void insertAfter (Node * prev_node, int new_data) { /*1. check if the given prev_node is NULL */ if (prev_node == NULL) { printf ("the given...
Can someone change this code from C to JavaScript. I wanna make an Android app. #include<stdio.h> #include<string.h> void DisplayOrder(struct PizzaTypes pizzaCart[100],struct PizzaCost costOnSize[12],char itemNames[12][100],int sidesCost[4]); struct PizzaTypes { int smallQuantity,mediumQuantity,largeQuantity,others,freshPan,cheeseBurst,wheatThinCrust; } ; struct PizzaCost { int smallCost,mediumCost,largeCost,freshPanCost,cheeseBurstCost,wheatThinCrustCost; } ; main() { int i=0,c=1,j=0,mainChoice,cost[24]= { 99,195,395,155,295,445,155,295,445,195,365,545,155,295,445,225,425,635,235,455,685,235,455,685 } ,totalCost=0,a[10]; char name[20]; char itemNames[12][100]= { "Margherita(Veg)", "Spicy Triple Tango(Veg)", "Double Cheese Margherita(Veg)", "Farm House(Veg)", "Cheese and Barbeque Chicken(Non Veg)", "Chicken Fiesta(Non Veg)", "Chicken Mexican(Non Veg)", "Chicken Golden Delight(Non Veg)", "Zingy Parcel Veg", "Zingy...