Program to calculate the average of 3 marks. If the average is more than or equal to 60 display “PASS” otherwise display “FAIL”

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Program to calculate the average of 3 marks. If the average is
more than or equal to 60 display “PASS” otherwise display
“FAIL”.

Expert Solution
Step 1

Note: Here you didn't mention any programming language so we are making the program in the C++ programming language.

Introduction of the Program:

The C++ program takes 3 subject marks from the user as input then the program calculates the average of the marks and if the average is more than or equal to 60 then the program displays PASS otherwise the program displays the FAIL.

Step 2

Source code of the Program: save the below code as main.cpp

//main.cpp
#include<iostream> //header files for cin/cout functions
using namespace std;
//start of main function
int main()
{
 //variable declaartion
 int num1,num2,num3;
 double avg;
 cout<<"Enter 3 subject marks : "<<endl;
 //taking three subject marks from the user
 cin>>num1>>num2>>num3;
 //calculating the average
 avg=(num1+num2+num3)/3.0;
 //displaying the average marks
 cout<<"Average of the Marks is : "<<avg<<endl;
 //checking condition to display PASS or FAIL
 if(avg>=60.0){
  cout<<"\nPASS"<<endl;
 }else
  cout<<"\nFAIL"<<endl;
} //end of main function

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY