Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 45

C++ Lab Work

Program 1

Write a C++ program to display “Hello World!!”


Program 2

Write a C++ program to display your Name, Roll


No, Department and Semester. (Display this
information in separate lines).
Program 3

Write a C++ program to print the value of a variable.


Program 4

Write a C++ program to display sum of two numbers.


Program 5

Write a C++ program to find the addition, subtraction,


multiplication and division of two numbers and
display on the screen.
Program 6+7 (Home Task)

 Write a C++ program to calculate the area of


rectangle. Hint:(Area of rectangle=L*W)

 Write a C++ program to calculate the area of


circle. Hint:(Area of circle=3.14*R*R)
Program 8

Write a C++ program to calculate the area of


circle by using Define Directive.

Hint:(Area of circle=PI*R*R)
Program 9

Write a C++ program to display, First alphabet


and your name, by using character and string
data type.
Program 10

Write a C++ program to input a number from


user.
Program 11

Write a C++ program to input two numbers


from user, perform addition and display the
result on the screen.
Program 12

Write a C++ program, input two numbers from


the user and perform addition, subtraction,
multiplication and division and display the
result on screen.
Program 13 (Home Task)

Write a C++ program, to calculate the area of


circle, where take value of radius from user.
Hint:(Area of circle=3.14*R*R)
Program 14 (Quiz Question)
Program 15

Write a C++ program that takes two numbers as


an input, apply Increment Operator on 1st
number and Decrement Operator on 2nd
number and display the result on screen.
Program 16

Write a program and make an expression which


show prefix increment operator working
For example expression:
 b = a++
 b= ++a
Program 17

Write a C++ program to solve the expression:


a*b/c+(c-b)

where a=5, b=10, and c=15 and display the


result on screen.
Program 18 (Home Task)

Write a C++ program to solve the expression:


a*b/(-c*31%13)*d

Where a=10, b=20, c=15 and d=8 and display


the result on screen.
Program 19

Write a C++ program to print positive


number if number is greater than 0.
Program 20

Write a C++ program to print positive


number if number is greater than 0
otherwise print number is negative .
Program 21

Write a C++ program to check whether an


integer is positive, negative or zero by
using conditions
Program 22

Write a C++ program that input marks


from user, and display PASS if marks are
greater than or equal to 50 and display
FAIL if marks are less than 50 .
Program 23

Write a C++ program that input number


from user, and finds whether number is
even or odd by using if-else structure.
Program 24 (Home Task)
Write a C++ program that marks from user, and
display grade according to the following
criteria:
Marks Grade
Marks>=90 A
80-89 B
70-79 C
60-69 D
Below 60 F
Program 25 (Home Task)

Write a C++ program that enter week


number from user and print day of week.

You might also like