Question

in C++ Write a program to use the IF ELSE statement in the following way. Have...

in C++

Write a program to use the IF ELSE statement in the following way.

Have the user input a value, x

If the value is less than 100, present, "you got 5% interest" and display on the screen the total of the X*1.05

Else print on the screen, "you got 10% interest", and display the value

X*1.10.

Homework Answers

Answer #1
#include<iostream>
using namespace std;
  
int main()
{
    int x;
    cout<<"Enter input: ";
    cin>>x;
    
    if(x<100){
        cout<<"you got 5% interest"<<endl;
        cout<<(x*1.05)<<endl;
    }
    else{
        cout<<"you got 10% interest"<<endl;
        cout<<(x*1.10)<<endl;
    }
    return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write some C++ program segments that solves the indicated tasks (you do not have to write...
Write some C++ program segments that solves the indicated tasks (you do not have to write a complete program, nor be concerned about "good" output; a small code segment will be enough). a) A program that gets a double number from the user, decides whether that number is positive, negative, or zero and display its decision on the screen. a) A function isPositive that takes as input a double number and returns the integer 1 if the number is positive,...
Write a C++ program that sets the maximum speed limit as a constant integer to be...
Write a C++ program that sets the maximum speed limit as a constant integer to be 120 Km/Hour. The program should read from the user an integer value representing the speed of a car. Use a nested if else to display a message based on the input speed: Speed < 10                      display      “Invalid speed” 10 <= Speed <= 120       display      “Speed is within limit” Speed > 120                    display      “Speed limit exceeded” At the end the program should display a message...
Problems . Using the if...else if...else if......else, write a C++ program that - Asks the user...
Problems . Using the if...else if...else if......else, write a C++ program that - Asks the user to input two integers. - If both of them are greater than zero, then output their sum. - If only one integer is greater than zero, then output their difference. - Otherwise, output a message "your two number <0".
1)Write a program that asks a user for a number. If (and only if) the number...
1)Write a program that asks a user for a number. If (and only if) the number is greater than zero print “The number is valid” 2)Write a program that asks a user for a grade. If (and only if) the grade is greater than zero and less than 101, print “The grade is valid” 3)Write a program that asks a user how many widgets they want to buy and prints out what the user should pay. Widgets costs 10 dollars....
Please Write code in visual studio Roman Numeral Converter Write a program that asks the user...
Please Write code in visual studio Roman Numeral Converter Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Roman numeral version of that number. Input Validation: Decide how the program should handle an input that is less then 1 or greater than 10.
5) Create a Java program using Scanner: Write a program where you will enter the grade...
5) Create a Java program using Scanner: Write a program where you will enter the grade score for 5 classes, then it will display total points and average and it will display the grade based on percentage. Steps: 1) Declare variable integer for English, Chemistry, Java Programming, Physics and Math 2) Declare variable total and percentage 3) Create Scanner object and prompt the user to enter grades for each class and input grades after each class 4) Calculate total of...
Write a program that checks the age of a user (C++ Programming)    If the user...
Write a program that checks the age of a user (C++ Programming)    If the user is 18 to 20 print “Sing a song” If the user is younger than 18 then print “Please show a dance step” Else Welcome the user and print “You are audience”
Write a program in C++ coding that asks the user to input an integer between 25...
Write a program in C++ coding that asks the user to input an integer between 25 and 50, inclusive. Utilize a WHILE loop to test for INVALID input. If the input is INVALID, the loop will repeat, and ask the user to try again. The pseudocode looks like this: Prompt user to input an integer between 25 and 50 Accept the input from the user Test for invalid input (HINT: use a while loop and the OR operator with 2...
4) Write a Java program using Conditions: Write a program where it will ask user to...
4) Write a Java program using Conditions: Write a program where it will ask user to enter a number and after that it will give you answer how many digits that number has. Steps: 1) Create Scanner object and prompt user to enter the number and declare variable integer for input 2) Use if else condition with && condition where you will specify the digits of numbers by writing yourself the digit number that should display: Example(num<100 && num>=1), and...
write a C++ program that asks the user to enter 4 integer numbers then use if...
write a C++ program that asks the user to enter 4 integer numbers then use if ….. elseif ….. elseif ….. else to find the smallest number then display it.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT