Question

In: Computer Science

write a program that takes two input values from the user and calculate the division if...

write a program that takes two input values from the user and calculate the division if the first number is greater than the second one otherwise calculate the multiplication.

Solutions

Expert Solution

#include <iostream>
using namespace std;

int main()
{
int num1,num2; // Variable declaration and initialization
  
cout << "Enter First Number: ";
cin>>num1; //get first number
cout << "Enter Second Number: ";
cin>>num2; //get second number
  
//check first number is greater than second number
if(num1>num2)
{
//Division operation is perform
cout<<"Division is: "<<(num1/num2)<<endl;
}
else
{
//Multiplication operation is perform
cout<<"Multiplication is: "<<(num1*num2)<<endl;
}
return 0;
}

===============================OUTPUT====================================

==Please Upvote==


Related Solutions

Q1-      Write a program that takes a list of values as an input from the user....
Q1-      Write a program that takes a list of values as an input from the user. The program should further ask the user about sorting the list in ascending or descending order. It is desirable to use Arraylist/Vector in place of simple arrays. (Object Oriented Programming java)
write a program that takes the input value from the user and calculate the sum from...
write a program that takes the input value from the user and calculate the sum from that number to zero in MIPS
Write a program that takes a string input from the user and then outputs the first...
Write a program that takes a string input from the user and then outputs the first character, then the first two, then the first three, etc until it prints the entire word. After going up to the full word, go back down to a single letter. LastNameUpDown. Input: Kean Output: K Ke Kea Kean Kea Ke K
• Write a C++ program that asks the user to input two integer values, then calls...
• Write a C++ program that asks the user to input two integer values, then calls a void function "swap" to swap the values for the first and second variable. • As we mentioned before, in order to swap the valors of two variables, one can use the following: temp= variable1; variable1 = variable2; variable2 = temp; • Display the two variables before you call swap and after you call that function. Comment in code would be greatly appreciated to...
Write a Java program that takes an array of 10 "Int" values from the user and...
Write a Java program that takes an array of 10 "Int" values from the user and determines if all the values are distinct or not. Return TRUE if all the values of the array are distinct and FALSE if otherwise.
IN C++ PLEASE Requirements Write a program that takes in user input of two integer numbers...
IN C++ PLEASE Requirements Write a program that takes in user input of two integer numbers for height and width and uses a nested for loop to make a rectangle out of asterixes. The creation of the rectangle (i.e. the nested for loop) should occur in a void function that takes in 2 parameters, one for height and one for width. Make sure your couts match the sample output (copy and paste from those couts so you don't make a...
Python Program 1: Write a program that takes user input in the form of a string...
Python Program 1: Write a program that takes user input in the form of a string Break up the string into a list of characters Store the characters in a dictionary The key of the dictionary is the character The value of the dictionary is the count of times the letter appears Hint: remember to initialize each key before using Output of program is the count of each character/letter Sort the output by key (which is the character) Python Program...
PART 1: WRITE A PROGRAM THAT TAKES IN TWO INTEGERS VALUE N AND M (USER INPUT)...
PART 1: WRITE A PROGRAM THAT TAKES IN TWO INTEGERS VALUE N AND M (USER INPUT) AND CALCULATES THE NTH FIBONACCI SUM USING RECURSION. EXAMPLE: OLD VERSION 0,1,1,2,3.. USING USER INPUT: 0, N, M ,N+M, (N+M)+M PART 2: WRITE THE SAME PROGRAM USING USER INPUT BUT USING A LOOP IN STEAD OF RECURSION. PYTHON
Write a program with two input values, Hours and Rate. The program should first calculate Gross...
Write a program with two input values, Hours and Rate. The program should first calculate Gross pay, which is your pay before deductions. The program should then calculate the following three deduction amounts: Federal Tax (20% of Gross), State Tax (5% of Gross), Social Security Tax (6.2% of Gross). Then your program should calculate Net pay, which is your Gross pay minus the three deductions. The output should be all five of the calculated values.
Write a program to calculate the amount of money in an account: The user will input...
Write a program to calculate the amount of money in an account: The user will input initial deposit and the number of years to leave that money in the account. The interest is constant at 0.5% for the entire length of time. The output will be the balance, with interest compounded annually. (simple interest formula: interest = principal * rate) What variables will you need to complete the program? What “controls” will you need for the program? What formula will...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT