Question
using C geany. Please Dr. exercise # 1 and 2

During the lab: PART I: PROGRAMMING EXERCISES a. Using Geany, write a C program that prompts and asks the user for two assign
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Exercise 1:

#include <stdio.h>
int main(void){
int a1,a2,t1,t2,avg;
char grade;
printf("Enter marks in %% for Assignment 1 out of 100%%\n");
scanf("%d",&a1);
printf("Enter marks in %% for Assignment 2 out of 100%%\n");
scanf("%d",&a2);
printf("Enter marks in %% for Test 1 out of 100%%\n");
scanf("%d",&t1);
printf("Enter marks in %% for Test 2 out of 100%%\n");
scanf("%d",&t2);
  
printf("Marks obtained are as follows:\n");
printf("Assignment 1: %d%% \n", a1);
printf("Assignment 2: %d%% \n", a2);
printf("Test 1: %d%% \n", t1);
printf("Test 2: %d%% \n", t2);
avg=(a1+a2+t1+t2)/4;
printf("The average is: %d%% \n", avg);
  
if(avg>=80)
{
grade='A';
printf("The letter grade is: %c", grade);
}
else
{
if(avg>=70)
{
grade='B';
printf("The letter grade is: %c", grade);
}

else
{
if(avg>=60)
{
grade='C';
printf("The letter grade is: %c", grade);
}
  
else
{
if(avg<60 && avg>=50)
{
grade='D';
printf("The letter grade is: %c", grade);
}
else
{
grade='F';
printf("The letter grade is: %c", grade);
}
}
}
}
}

Exercise 2:

#include <stdio.h>
int main(void){
int a1,a2,t1,t2,avg;
char grade;
printf("Enter marks in %% for Assignment 1 out of 100%%\n");
scanf("%d",&a1);
printf("Enter marks in %% for Assignment 2 out of 100%%\n");
scanf("%d",&a2);
printf("Enter marks in %% for Test 1 out of 100%%\n");
scanf("%d",&t1);
printf("Enter marks in %% for Test 2 out of 100%%\n");
scanf("%d",&t2);
  
printf("Marks obtained are as follows:\n");
printf("Assignment 1: %d%% \n", a1);
printf("Assignment 2: %d%% \n", a2);
printf("Test 1: %d%% \n", t1);
printf("Test 2: %d%% \n", t2);
avg=(a1+a2+t1+t2)/4;
printf("The average is: %d%% \n", avg);
if(t1<50 || t2<50)
{
grade='F';
printf("The letter grade is: %c", grade);
}
else
{
if(avg>=80)
{
grade='A';
printf("The letter grade is: %c", grade);
}
else
{
if(avg>=70)
{
grade='B';
printf("The letter grade is: %c", grade);
}

else
{
if(avg>=60)
{
grade='C';
printf("The letter grade is: %c", grade);
}
  
else
{
if(avg<60 && avg>=50)
{
grade='D';
printf("The letter grade is: %c", grade);
}
else
{
grade='F';
printf("The letter grade is: %c", grade);
}
}
}
}
}
}

Add a comment
Know the answer?
Add Answer to:
using C geany. Please Dr. exercise # 1 and 2 During the lab: PART I: PROGRAMMING...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Programming Assignment: LetterGrade

    please answer in c and not c++LetterGrade.cA student’s letter grade is calculated according to the following schedule. Write a C program LetterGrade using an IDE (CodeBlocks) that accepts a student’s numerical grade, converts the numerical grade to an equivalent letter grade, and displays the letter grade.Numerical GradeLetter GradeGreater than or equal to 90ALess than 90 but greater than or equal to 80BLess than 80 but greater than or equal to 70CLess than 70 but greater than or equal to 60DLess...

  • I need help doing this practice exercise in Scratch. I am not sure where to start...

    I need help doing this practice exercise in Scratch. I am not sure where to start Your task is to make a Scratch program that will tell you the letter grade based on the percentage. 1. Create a variable grade (have grade display as a scroll bar). 2. When the green flag is clicked, the program should look at the value of the grade and the Sprite should respond with a letter as follows: A: greater than 89 B: greater...

  • Java Programming

    3-5 Grade Determination.Write a program that will input three test scores. The program should determine and display their average. The program should then display the appropriate letter grade based on the average. The letter grade should be determined using a standard 10-point scale. ( A = 90 – 100, B = 80 – 89.999, C = 70 -79.999, D = 60 – 69.999, F = below 60)

  • Modify Assignment #18 so it drops each student’s lowest score when determining the students’ test score...

    Modify Assignment #18 so it drops each student’s lowest score when determining the students’ test score average and Letter grade. No scores less than 0 or greater than 100 should be accepted #include<iostream> #include<string> using namespace std; int main() { double average[5]; string name[5]; char grade[5]; for(int i=0; i<=5; i++) { cout<<"Enter student name: "; cin.ignore(); getline(cin,name[i]); int sum=0; for(int j=0; j<5; j++) { int grades; cout<<"Enter Grades:"<<j+1<<" : "; cin>>grades; sum+=grades; } average[i]=(float)sum/5; if(average[i]>=90 && average[i]<=100) grade[i]='A'; else if(average[i]>=80...

  • PLEASE DO THIS IN C#.Design and implement a program (name it ProcessGrades) that reads from the...

    PLEASE DO THIS IN C#.Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered: 95, 80, 100, 70 Highest grade: 100 Lowest grade: 70 Average grade: 86.25

  • C++ Language A continuation of your grading software will be made you do not need your...

    C++ Language A continuation of your grading software will be made you do not need your other code for this assignment). In this one you will intake a students first name and last name from a file called "students.txt". Next, there is a file called grades.txt that contains the grades in a course. There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt" there are two students first and last names. In "grades.txt" the...

  • In Python In this programming assignment, you will do multiple programming exercises, and eventually develop a...

    In Python In this programming assignment, you will do multiple programming exercises, and eventually develop a Python application that can calculate student course grades. (6 points) Write a program called p2-1.py to: (1) create a list and add integer numbers from 1 to 100 to the list; (2) calculate the average value of all numbers in the list; and (3) print the result (screenshots). (8 points) Write a program called p2-2.py to: (1) allow a user to define how many...

  • (Statistics) a. Write a C++ program that reads a list of double-precision scores from the keyboard...

    (Statistics) a. Write a C++ program that reads a list of double-precision scores from the keyboard into an array named scores. It is assumed that the user will enter no more than 35 scores. The scores are to be counted as they're read, and entry is to be terminated when a negative value has been entered. After all scores have been input, your program should find and display the sum and average of the scores. The scores should then be...

  • A continuation of your grading software will be made (you do not need your other code...

    A continuation of your grading software will be made (you do not need your other code for this assignment). In this one you will intake a students first name and last name from a file called "students.txt". Next, there is a file called grades.txt that contains the grades in a course. There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt" there are two students first and last names. In "grades.txt" the grades for...

  • I've built a C++ program that calculates the user's class average based on three test. Can...

    I've built a C++ program that calculates the user's class average based on three test. Can somebody show me how to get the program to look for invalid input? #include <iostream> #include <string> #include <iomanip> using namespace std; int main() { //variables int score_1; //test 1 input from user int score_2; //test 2 input from user int score_3; //test 3 input from user int highest; // the higher score of test 1 & 2 int course_average; //average for class //Introduce...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT