Skip to content

Latest commit

 

History

History
22 lines (21 loc) · 1.55 KB

conditional-pratice-questions.md

File metadata and controls

22 lines (21 loc) · 1.55 KB

Conditional Statement Practice

  1. Write a program that prompts the user to enter the speed of a vehicle. If speed is less than 20, display too slow; if speed is greater than 80, display too fast; but alwyas display drive safe.
  2. Write a program that prompts the user to enter the total_bil_amount. If bill amount greater than or equal to 2000, calculate and print the final_bill_amount by giving 10 percent discount. If bill amount is less than 2000 then print No Discount.
  3. Write a program that reads three edges of a triangle and computes and display the area if the input is valid. Otherwise, it displays that the input is invalid. The input is valid if all the edges of the triangle are equal.Formula for calculating area:
    Area = 0.433012 * edge * edge
    
  4. Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to Indian Rupee. Prompt the user to enter 0 to convert from U.S. dollars to Indian Rupee and 1 to convert from Indian Rupee and U.S. dollars. Prompt the user to enter the amount in U.S. dollars or Indian Rupee to convert it to Indian Rupee or U.S. dollars, respectively. Here are the sample runs:
    Enter the exchange rate from dollars to Indian Rupee: 83.61
    Enter 0 to convert dollars to Indian Rupee and 1 vice versa: 0
    Enter the dollar amount: 100
    $100 is  8361 INR
    
    Enter the exchange rate from dollars to Indian Rupee: 83.61
    Enter 0 to convert dollars to Indian Rupee and 1 vice versa: 1
    Enter the INR amount: 1000
    1000 INR is 11.96 USD