CS Practical list for SSC 2
CS Practical list for SSC 2
Exercise No. 1
Write a program that should take working hours and overtime hours of employee as input. The program should
calculate and display the total salary of employee.
Exercise No. 2
Write a program that takes Celsius temperature as input, converts the temperature into Fahrenheit and shows the
output.
Exercise No. 3
Write a program that displays the following output using single printf statement.
Such as * * * *
And 1 2 3 4
Exercise No. 4
Write a program that displays the following output using single printf statement: I am a Boy I live in Pakistan I am
a proud Pakistani.
Exercise No. 5
A cloth brand offers 15% discount on each item. A lady buys 5 shirts from this brand. Write a program that
calculates total price after discount and amount of discount availed by the lady. Original prices of the shirts are:
Exercise No. 6
Write a program that swaps the value of two integer variables without help of any third variable.
Exercise No. 7
Write a program that takes a 5-digit number as input, calculates and displays the sum of first and last digit of
number.
Exercise No. 8
Write a program that takes monthly income and monthly expenses of the user like electricity bill, gas bill, food
expense. Program should calculate the following.
Exercise No. 9
Write a program that takes radius of a circle as input. The program should calculate and display the area of circle.
EXERCISE 10:
Write a program that takes two integers as input and tells whether first one is a factor of the second one?
EXERCISE 11:
Write a program that takes total bill as input and tells how much discount the user has got and what the
discounted price is?
EXERCISE: 12
Write a program that takes as input, the original price and sale price of a product and tells whether the product is
sold on profit or loss. The program should also tell the profit/loss percentage.
EXERCISE: 13
Write a program that takes as input, the lengths of 3 sides of a triangle and tells whether it is a right-angle triangle
or not? For a right-angled triangle, Hypotenuse2= base2 + height2
EXERCISE: 14
EXERCISE 15
a)
*****
*****
*****
b)
BC
DEF
GHIJ
EXERCISE 16
Write a program that takes two positive integers a and b as input and displays the value of ab.
EXERCISE 17
Write a program that takes two numbers as input and displays their Greatest Common Divisor (GCD) using
Euclidean method.
EXERCISE 18
Write a program to display factorials numbers from 1 to 7. (Hint: Use Nested Loops)
EXERCISE 19
Write a program that takes 10 numbers as input in an array and displays the product of first and last element on
console.
Exercise 20
Exercise 21
Write a function to calculate factorial of a number.
Exercise 22
Write a function which takes values for three angles of a triangle and prints whether the given values make a valid
triangle or not. A valid triangle is the one, where the sum of three angles is equal to 180.
Exercise 23
Write a function which takes the amount and the interest percentage and return the interest amount.
Exercise 24