Intro to Conditional Statements

Objective
In this challenge, we’re getting started with conditional statements. Check out the Tutorial tab for learning materials and an instructional video!

Task
Given an integer, nn, perform the following conditional actions:

  • If nn is odd, print WeirdWeird.
  • If nn is even and in the inclusive range of 22 to 55, print Not WeirdNot Weird.
  • If nn is even and in the inclusive range of 66 to 2020, print WeirdWeird.
  • If nn is even and greater than 2020, print Not WeirdNot Weird.

Complete the stub code provided in your editor to print whether or not nn is weird.

Input Format

A single line containing a positive integer, nn.

Constraints

  • 1n1001≤n≤100

Output Format

Print WeirdWeird if the number is weird; otherwise, print Not WeirdNot Weird.

Sample Input 0

Sample Output 0

Sample Input 1

Sample Output 1

Explanation

Sample Case 0:n=3n=3
nn is odd and odd numbers are weird, so we print WeirdWeird.

Sample Case 1:n=24n=24
n>20n>20 and nn is even, so it isn’t weird. Thus, we print Not WeirdNot Weird.

 

Output

Congratulations, you passed this test case in 0.0600/4 seconds!
Input (stdin)
3
Your Output (stdout)
Weird
Expected Output
Weird

Operators – Java

Objective
In this challenge, you’ll work with arithmetic operators. Check out the Tutorial tab for learning materials and an instructional video!

Task
Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total cost.

Note: Be sure to use precise values for your calculations, or you may end up with an incorrectly rounded result!

Input Format

There are 33 lines of numeric input:
The first line has a double, mealCostmealCost (the cost of the meal before tax and tip).
The second line has an integer, tipPercenttipPercent (the percentage of mealCostmealCost being added as tip).
The third line has an integer, taxPercenttaxPercent (the percentage of mealCostmealCost being added as tax).

Output Format

Print The total meal cost is totalCost dollars.The total meal cost is totalCost dollars., where totalCosttotalCost is the rounded integer result of the entire bill (mealCostmealCost with added tax and tip).

Sample Input

Sample Output

Explanation

Given:
mealCost=12mealCost=12, tipPercent=20tipPercent=20, taxPercent=8taxPercent=8

Calculations:
tip=12×20100=2.4tip=12×20100=2.4
tax=12×8100=0.96tax=12×8100=0.96
totalCost=mealCost+tip+tax=12+2.4+0.96=15.36totalCost=mealCost+tip+tax=12+2.4+0.96=15.36
round(totalCost)=15round(totalCost)=15

We round totalCosttotalCost to the nearest dollar (integer) and then print our result:

Congratulations, you passed this test case in 0.0600/4 seconds!
Input (stdin)
12.00
20
8
Your Output (stdout)
The total meal cost is 15 dollars.
Expected Output
The total meal cost is 15 dollars.