Computer Science, asked by vandana9794947481, 1 day ago

Write a program to accept marks of a student obtained in 5 different subjects (English
Phy., Chem., Biology, Maths.) and find the average. If the average is 80% or more then
he/she is eligible to get “Computer Science otherwise “Biology".​

Answers

Answered by Equestriadash
4

Co‎de: [in Python language]

\tt Eng\ =\ float(in put("Enter\ the\ marks\ obtained\ in\ English:\ "))\\Phy\ =\ float(in put("Enter\ the\ marks\ obtained\ in\ Physics:\ "))\\Chem\ =\ float(in put("Enter\ the\ marks\ obtained\ in\ Chemistry:\ "))\\Bio\ =\ float(in put("Enter\ the\ marks\ obtained\ in\ Biology:\ "))\\Math\ =\ float(in put("Enter\ the\ marks\ obtained\ in\ Math:\ "))

\tt avg\ =\ (Eng\ +\ Phy\ +\ Chem\ +\ Bio\ +\ Math)/5\\if\ avg\ >=\ 80:\\{\ \ \ \ \ }print("You\ are\ eligible\ for\ Computer\ Science.")\\else:\\{\ \ \ \ \ }print("You\ are\ eligible\ for\ Biology.")

Explanation:

We use the \tt in put() function to obtain the marks using \tt float() as the datatype, since marks could also be in decimal values and store them in suitable variables. After that's done, we calculate the average and store it in the 'avg' variable. We then pas‎s a conditional statement, which is a statement used to check for a required condition, and if the required condition is satisfied, the succeeding command is pas‎sed, which is the required \tt print() statement.

Similar questions