Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
23 views2 pages

Conditional Statement Programs

The document outlines a series of practical programming exercises focusing on conditional statements in computer science. It includes tasks such as checking if a number is single-digit, displaying days of the week, and determining if a year is a leap year. Additionally, it involves debugging code, predicting outputs, and creating various programs based on user input.

Uploaded by

Muhammed Kashif
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)
23 views2 pages

Conditional Statement Programs

The document outlines a series of practical programming exercises focusing on conditional statements in computer science. It includes tasks such as checking if a number is single-digit, displaying days of the week, and determining if a year is a leap year. Additionally, it involves debugging code, predicting outputs, and creating various programs based on user input.

Uploaded by

Muhammed Kashif
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/ 2

COMPUTER SCIENCE (O83)

Conditional Statements (Practical)


1. Write a program to check whether a number is single digit or not
2. WAP to display the days of a week based on the value (1 to 7) given
3. WAP to check whether a number is even or odd.
4. WAP to convert the temperature in Celsius to Fahrenheit
5. WAP to check whether a triangle is equilateral or not
6. Display the grade of a students based on the total marks scored.

7. Predict the output of the following code fragment.

8. Find the error in the given code and redesign the code to get the output.

9. Predict the output of the given code:


10. Write a program that reads from user — (i) an hour between 1 to 12 and (ii) number of hours ahead. The
program should then print the time after those many hours, e.g.,
Enter hour between 1-12 : 9
How many hours ahead : 4
Time at that time would be : 1 O'clock
11. Write a program that asks the user for two numbers and prints Close if the numbers are within .001 of each other
and Not close otherwise.
12. A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years unless they are
also divisible by 400. Write a program that asks the user for a year and prints out whether it is a leap year or not.
13. Write a short program to input a digit and print it in words.
14. Develop a program to display either the area of a square or area of a circle or area of a rectangle based on user’s
choice.
15. Check whether a person is eligible to take the covid vaccine.
16. Write a program that prompts the user to enter a number and then checks if the number is positive, negative or
zero. Print an appropriate message for each case.
17. Write a program that asks the user for their height and weight and then calculates their body mass index (BMI).
(BMI = weight (in kilograms) / height 2 (in meters).
18. Simulate the working of logical operators chosen by the user.
19. Design a simple calculator in Python.
20. Develop a program to check whether a username and password is valid.

You might also like