Professional Documents
Culture Documents
Simple Conditional Statements Javascript
Simple Conditional Statements Javascript
If a student's score is above 90, print "Excellent", else if it's above 80, print "Very Good",
else print "Good".
If a number is positive, print "Positive", else if it's negative, print "Negative", else print
"Zero".
If a person's age is less than 18, print "Minor", else if it's between 18 and 65, print
"Adult", else print "Senior".
If a student's grade is 'A', print "Excellent", else if it's 'B', print "Good", else if it's 'C', print
"Average", else print "Below Average".
If a temperature is above 30°C, print "Hot", else if it's between 20°C and 30°C, print
"Warm", else print "Cold".
If a vehicle's fuel level is less than 25%, print "Low fuel", else if it's between 25% and
50%, print "Moderate fuel", else print "Sufficient fuel".
If a student's attendance is less than 75%, print "Warning", else if it's between 75% and
90%, print "Satisfactory", else print "Excellent".
If a country's population is above 100 million, print "High population", else print "Low
population".
If a movie is rated 'PG', print "Suitable for all ages", else if it's rated 'PG-13', print
"Parental guidance suggested", else print "Adults only".
If a person's salary is less than $1000, print "Low income", else if it's between $1000
and $5000, print "Moderate income", else print "High income".
If a day is a weekend, print "It's a weekend", else print "It's a weekday".
If a country has a GDP growth rate above 5%, print "High growth", else if it's between
2% and 5%, print "Moderate growth", else print "Low growth".
If a person's blood pressure is less than 120/80, print "Normal", else if it's between
120/80 and 139/89, print "Prehypertension", else print "Hypertension".
If a student's rank is below 100, print "Top 100", else print "Beyond top 100".
If a coupon is expired, print "Expired", else if it's about to expire in less than a week,
print "Expiring soon", else print "Valid".
If a city's crime rate is above 50%, print "High crime rate", else if it's between 25% and
50%, print "Moderate crime rate", else print "Low crime rate".
If a dish contains meat, print "Non-vegetarian", else print "Vegetarian".
If a person's shoe size is above 10, print "Large size", else if it's between 8 and 10, print
"Medium size", else print "Small size".
If a student's GPA is above 3.5, print "Honors", else if it's between 3.0 and 3.5, print
"High distinction", else if it's between 2.5 and 3.0, print "Distinction", else print "Pass".
If a room's temperature is above 25°C and the humidity is above 60%, print "Hot and
humid", else if it's above 25°C, print "Hot", else if it's below 15°C, print "Cold", else print
"Comfortable".
If a package weighs more than 10 kg, print "Heavy", else if it's between 5 kg and 10 kg,
print "Moderate", else print
Weather Forecast: If the temperature is above 80°F, print "It's a hot day"; otherwise,
print "Enjoy the weather."
Grading System: If the score is above 90, print "A"; if it's between 80 and 90, print "B";
else print "C."
Age Verification: If the user is above 18 years old, allow access; otherwise, display a
message "Access denied."
Discount Calculator: If the purchase amount is over $100, apply a 10% discount;
otherwise, no discount is applied.
Traffic Light: If the light is green, print "Go"; if it's yellow, print "Slow down"; if it's red,
print "Stop."
Ticket Pricing: If the age is under 12, the ticket price is $5; if it's between 12 and 18, the
price is $10; otherwise, it's $15.
Banking App: If the balance is below $1000, display a message "Low balance";
otherwise, "Sufficient balance."
Meal Selection: If the user picks "pizza," display a message "Enjoy your pizza";
otherwise, "Bon appétit!"
Movie Ratings: If the rating is 5 stars, print "Excellent"; if it's 4 stars, print "Very Good"; if
it's 3 stars, print "Good"; otherwise, "Fair."
Library Membership: If the user is a student, grant access to borrow books; otherwise,
only allow browsing.
Phone Charger: If the phone battery is below 20%, display "Low battery"; otherwise,
"Battery is sufficient."
Movie Ticket Booking: If the user selects a showtime after 6 PM, apply a $5 evening
surcharge; otherwise, no surcharge is applied.
Hotel Booking: If the number of guests exceeds the room capacity, display "Room full";
otherwise, "Room available."
Student Eligibility: If the student has passed all subjects, print "Eligible for promotion";
otherwise, "Reappear for failed subjects."
Credit Card Approval: If the user's credit score is above 700, approve the credit card
application; otherwise, reject it.
Game Levels: If the player reaches level 10, display "Congratulations, you've reached
the final level"; otherwise, "Keep playing to unlock more levels."
Car Rental: If the user's age is below 25, apply a young driver surcharge; otherwise, no
surcharge is applied.
Flight Booking: If the departure time is within 3 hours, display "Check-in now";
otherwise, "Check-in opens 3 hours before departure."
Temperature Control: If the room temperature is above 75°F, activate the air conditioner;
otherwise, no action is needed.
Fitness App: If the user's step count exceeds 10,000, display "Great job"; otherwise,
"Keep moving!"
Online Shopping: If the item is out of stock, display "Item not available"; otherwise, "Add
to cart."
Pet Adoption: If the user selects a puppy, display "Congratulations on your new furry
friend"; otherwise, "Browse other pets."
Voting Eligibility: If the user's age is above 18 and citizenship status is "citizen," grant
voting rights; otherwise, "Not eligible to vote."
Product Warranty: If the purchase date is within a year, display "Warranty active";
otherwise, "Warranty expired."
Meeting Schedule: If the meeting time overlaps with another appointment, display
"Schedule conflict"; otherwise, "Meeting confirmed."
Credit Limit: If the user's credit utilization ratio is below 30%, increase the credit limit;
otherwise, maintain the current limit.
Restaurant Reservation: If the reservation time is during peak hours, display "Limited
availability"; otherwise, "Reservation confirmed."
Bus Fare: If the user is a senior citizen, apply a 50% discount on the fare; otherwise, no
discount is applied.
Parcel Delivery: If the delivery address is within the service area, proceed with delivery;
otherwise, "Out of service area."
Online Course Enrollment: If the course prerequisites are met, allow enrollment;
otherwise, "Pre-requisites not fulfilled."
Hotel Check-in: If the check-in time is after 3 PM, display "Check-in time reached";
otherwise, "Check-in opens at 3 PM."
Flight Status: If the flight is delayed by more than 2 hours, display "Flight delayed";
otherwise, "On-time departure."
Library Book Return: If the book is overdue, display "Late return fee applicable";
otherwise, "Book returned successfully."
Gym Membership Renewal: If the membership has expired, display "Renew
membership"; otherwise, "Membership active."
Food Delivery: If the delivery address is within the delivery radius, proceed with the
order; otherwise, "Out of delivery range."
Credit Card Payment: If the minimum payment is made, display "Payment received";
otherwise, "Minimum payment required."
Online Auction: If the bid amount exceeds the reserve price, display "Bid accepted";
otherwise, "Bid too low."
Gardening Tips: If the soil moisture is low, display "Water the plants"; otherwise, "No
need to water."
Discount Voucher: If the voucher code is valid, apply the discount; otherwise, "Invalid
voucher code."
Flight Upgrade: If the user selects a premium seat, display "Upgrade to premium class";
otherwise, "Economy class booked."
Package Tracking: If the package is out for delivery, display "Expected delivery today";
otherwise, "In transit."
Insurance Claim: If the claim documentation is complete, process the claim; otherwise,
"Incomplete documentation."
Parking Permit: If the parking permit is valid, display "Parking allowed"; otherwise, "No
parking permit."
Internet Connectivity: If the internet connection is unstable, display "Connection lost";
otherwise, "Connected to the internet."