Purchase Solution

C Coding and Average GPA

Not what you're looking for?

Ask Custom Question

1. My C code cant compile and i cant see the problem can u fix it?

2. write a c code or Modify the code to ask user to input 5 gpas. then the program calculates the average of the gpa and prints it to screen. i.e(The average of all Gpas you entered is 3.87). this code should also check gor negative inputes ie( if user inputs -2.6 or a gpa hight or lower than 1 to 4.0, it print invalisd gpa to the screen.

--------------------------------------------------------------------------------------------
#include <stdio.h>

main ()

/* This C code outputs the equivalent GPA letter grade of a student */
{
float x;

printf("Please enter a GPA value: n");
scanf("%f", &x);

/* An if else statement that sonditions the out of grades*/

if (x < 1.0)
{
Printf("A gpa of %.0f is a grade F: n", x);
}
else if (x >= 1.0 || x < 1.7)
{
Printf("A gpa of %.0f is a grade D: n", x);
}
else if (x >= 1.7 || x < 2.7)
{
printf("A gpa of %.0f is a grade C: n", x);
}
else if (x >= 2.7 || x < 3.5)
{
printf("A gpa of %.0f is a grade B: n", x);
}
else if (x >= 3.5)
{
printf("A gpa of %.0f is a grade A: n", x);
}
return (1);
}

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.