0% found this document useful (0 votes)
76 views7 pages

CS-114 Report - 2

CS-114 Fundamentals of Programming Lab Report 2, National University of Science and Technology CEME NUST

Uploaded by

Fatima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views7 pages

CS-114 Report - 2

CS-114 Fundamentals of Programming Lab Report 2, National University of Science and Technology CEME NUST

Uploaded by

Fatima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CS-114 |Fundamentals of

Programming

Lab: 02- Variables, Data Types


& Logic Building

Submitted to: Sir M. Ismail

Submitted by: Fatima Mansoor


(Reg. No. 295982)
Of CE-41 Syndicate B
Lab Objective:
To get familiarized with different data types in Visual Studio, develop
understanding of variables, take input from user, display output to screen and
write simple programs using C++ language.

Task 01:
Write a C++ code that takes radius of a circle as input from user and outputs
the circumference and area. The output should be clear and readable. Add
proper comments to the code. Google search for the appropriate data types.
You can set the value of pi up to 3 decimal places.

Code 1

Output 1

2
Task 02:
Write a C++ code that takes values of a and b from the user and displays
result of polynomial a2 + 2ab + b2.

Code 2

Output 2

3
Task 03:
Write a program that asks the user to enter a value for x and then displays the
value of the following polynomial 2x5 + 3x4 – x3 – 2x2 + 7x – 6.

Code 3

Output 3

4
Task 04:
Write a program to calculate the distance between two points using distance
formula when coordinates of both the points are input by user.

Code 4 (part 1)

Code 4 (part 2)

Output 4
5
Task 05:
Write a program that takes two number as input from the user along with the
choices of operation (i.e. addition, subtraction, multiplication or division) that
needs to be performed upon them. Display the appropriate result.

Code 5

Output 5 (Part 1)

Output 5 (Part 2)

Output 5 (Part 3)

6
Output 5 (Part 4)

Task 06:
Ask the user to enter the marks of a subject out of 100. Display an ‘A’ grade in
case the marks are more than 80, a ‘B’ if they are from 71 to 80, a ‘C’ if they
exceed 60 but are below 71, and an ‘F’ for marks 60 or below.

Code 6

Output 6 (Part 1)

Output 6 (Part 2)

Output 6 (Part 3)

You might also like