Assignment 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Assignment 1

1) Take values of length and breadth of a rectangle from user and check if it is
square or not.

2) Check whether a number is single digit, double digit or triple Digit

3) A shop will give discount of 10% if the cost of purchased quantity is more
than 1000.
Ask user for quantity
Suppose, one unit will cost 100.
Judge and print total cost for user.

4) A company decided to give bonus of 5% to employee if his/her year of service is


more than 5 years. Ask user for their salary and year of service and print the
netbonus amount.

5) Take input of age of 3 people by user and determine oldest and youngest among
them.
6) Write a program to print absolute value of a number entered by user. E.g.
INPUT:1 OUTPUT: 1
INPUT: -1 OUTPUT: 1

7) A student will not be allowed to sit in exam if his/her attendence is less than
75%.
Take following input from user
Number of classes held.
Number of classes attended.
And print percentage of class attended Is student is allowed to sit in exam or not.
Modify the above question to allow student to sit if he/she has medical cause.
Ask user if he/she has medical cause or not ('Y' or 'N') and print accordingly.

8) Ask user to enter age, sex (Mor F), marital status (Y or N) and then using
following rules print their place of service. If employee is female, then she will
work only in urban areas. If employee is a male and age is in between 20 to 40
then he may work in anywhere. If employee is male and age is in between 40 to
60 then he will work in urban areas only. And any other input of age should print
"ERROR".

9) Write a program to solve quadratic equations (use if, else if and else).

10) Write a program that reads a floating-point number and prints "zero" if the
number is zero. Otherwise, print "positive" or "negative". Add "small" if the
absolute value of the number is less than 1, or "large" if it exceeds 1000000.

11) Write a program that keeps a number from the user and generates an integer
between 1 and 7 and displays the name of the weekday.

12) Write a program to find the number of days in a month.

You might also like