Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Student name: AYESHA AKBAR

Semester: 2ND
Registration # FA23-BCS-150
Submitted to : MAM IQRA

Q=1 What are library functions? Discuss in details with examples.


Answer:

The library functions are pre-defined functions provided by programing language


or by libraries to perform a specific task. These functions are already implemented
and available to use. They save developers time and effort by providing commonly
used functionalities without having to implement them. They are also known as
standard library functions or built in functions

Following are some of its details:

Purpose:

It serves various purposes which include mathematical computation, string


manipulation and input output operations, memory management and many more

Consistency:

Library functions are consistent follow a behavior across different platform ensure
probability and ease of use

Efficiency:

Library function are often optimized for performance and reliability benefiting
from years of refinement and testing

Examples:
In c language “ printf ” ,” scanf “
In c++ language “ cout ” ,” cin ”
In python “ print ”, “ len()’’

Q#2 An athematic assignment operator combines the effect of what


two operators?

An athematic assignment operator combines the effect of an athematic operator


and an assignment operator. They perform the operations of a binary operator like
+, -, * / and store the bin a particular variable like we say
Int a
a +=a;

Q#3 Write a program to calculate grade of your marks in different


cases by taking input from User,
Case 1: if mark is and in-between 50-60 grade will be C
Case 2: if mark is and in-between 60-70 grade will be C+
Case 3: if mark is and in-between 60-70 grade will be B
Case 4: if mark is and in-between 70-80 grade will be B+
Case 5: if mark is and in-between 80-90 grade will be A

code
Outputs are below of every case:
Q:4 Write a program that produces the following output using Coot
statement.
++
++
+++++++++++++++
+++++++++++++++
++
++

code

Output is below
Q:5 A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm
ships carton of milk

To a local grocery store. The cost of producing one liter of milk is $0.38, and
the profit of each
Carton of milk is $0.27. Write a program that does the following:
Prompts the user to enter the total amount of milk produced in the morning
Outputs the number of milk cartons needed to hold milk.

Outputs the cost of producing milk.


Outputs the profit for producing milk.

Code is below:

You might also like