Question

In: Computer Science

You are using ONLY Programming Language C for this: In this program you will calculate the...

You are using ONLY Programming Language C for this:

In this program you will calculate the average of x students’ grades (grades will be stored in an array). Here are some guidelines to follow to help you out:

1. In your program, be sure to ask the user for the number of students that are in the class. The number will help in declaring your array.

2. Use the function to scan the grades of the array. To say another way, we will populate the array with a function.

3. When done, you are going to use a printing function to make sure all grades are scanned correctly.

4. After that, you will call the “average” function. This function will receive two parameters: the array’s length and the array. Inside that function, you will calculate the average (use a loop for this) and you will return the average.

5. In main, you will have received this returned value and print it (IMPORTANT).

Solutions

Expert Solution

This Solution is for only 1 student, Although I have created the test cases so you go any number of test cases. 

#include<stdio.h>
void main()
{
    int t; //For Test Cases
    scanf("%d",&t);
    while(t--)
    {
        int mark[5], i; //Creating Marks in array
        float sum=0,avg; 
        printf("Enter marks obtained in 5 subjects :");
        for(i=0; i<5; i++) //Using Loop to enter marks
        {
                scanf("%d",&mark[i]);
                sum=sum+mark[i];
        }
        avg=sum/5; //Average Formula
        printf("Your Grade is "); //Assuming Grades for students
        if(avg>80)
        {
                printf("A");
        }
        else if(avg>60 && avg<=80)
        {
                printf("B");
        }
        else if(avg>40 && avg<=60)
        {
                printf("C");
        }
        else
        {
                printf("D");
        }
    }

}

Related Solutions

Only Program in C for this. No other programming language is allowed. Using a function, we...
Only Program in C for this. No other programming language is allowed. Using a function, we will add a range of values of an array. The range is going to be determined by the user. In this example, if you put the following array down as: 1.5 -5.6 8.9 4.6 7.8 995.1 45.1 -5964.2 … and the user tells you to add from the 3rd element to the 6th element, your program is going to need to add the values:...
Write a program that performs a merge-sort algorithm without using a recursion. c++ programming language(Only #inlclude...
Write a program that performs a merge-sort algorithm without using a recursion. c++ programming language(Only #inlclude <iostream>)
Using C# programming language, Write a program that sort three numbers entered by the user using...
Using C# programming language, Write a program that sort three numbers entered by the user using only if and nested if statements. If for instance the user entered 5, 2, and 7; the program should display 2,5,7.
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
Using the C Programming language, write a program that sums an array of 50 elements. Next,...
Using the C Programming language, write a program that sums an array of 50 elements. Next, optimize the code using loop unrolling. Loop unrolling is a program transformation that reduces the number of iterations for a loop by increasing the number of elements computed on each iteration. Generate a graph of performance improvement. Tip: Figure 5.17 in the textbook provides an example of a graph depicting performance improvements associated with loop unrolling. Marking:- Optimize the code for an array of...
Using c# programming language Write a program that mimics a lottery game. Have the user enter...
Using c# programming language Write a program that mimics a lottery game. Have the user enter 3 distinct numbers between 1 and 10 and match them with 3 distinct, randomly generated numbers between 1 and 10. If all the numbers match, then the user will earn $10, if 2 matches are recorded then the user will win $3, else the user will lose $5. Keep tab of the user earnings for, let say 5 rounds. The user will start with...
C Programming Language: For this lab, you are going to create two programs. The first program...
C Programming Language: For this lab, you are going to create two programs. The first program (named AsciiToBinary) will read data from an ASCII file and save the data to a new file in a binary format. The second program (named BinaryToAscii) will read data from a binary file and save the data to a new file in ASCII format. Specifications: Both programs will obtain the filenames to be read and written from command line parameters. For example: - bash$...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( test 1, test 2, and test 3), homework, and final project grades then calculate and display the overall grade along with a message, using the selection structure (if/else). The message is based on the following criteria: “Excellent” if the overall grade is 90 or more. “Good” if the overall grade is between 80 and 90 ( not including...
In C programming language, write the program "3x3" in size, calculating the matrix "c = a...
In C programming language, write the program "3x3" in size, calculating the matrix "c = a * b" by reading the a and b matrices from the outside and writing on the screen?
LANGUAGE: C Only using <stdio.h> & <stdlib.h> Write a program that gives the user a menu...
LANGUAGE: C Only using <stdio.h> & <stdlib.h> Write a program that gives the user a menu to choose from – 1. Convert temperature input from the user in degrees Fahrenheit to degrees Celsius 2. Convert temperature input from the user in degrees Celsius to degrees Fahrenheit 3. Quit. Formulae you will need: C = (5 / 9) * (F-32) and F = (9/5) * C + 32 1. Use functions to accomplish 1 and 2 above. 2. Use at least...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT