Concept explainers
18. a. What is the output of the program in Exercise 17, if first = 16 and second = 5?
17. What is the output of the following program? #include using namespace std; int main() int first = 16; int second = 8;
if ((first / second == 2) || (second / first == 3)) second = 10; first = 20; else if ((first % second == 2 || second % first == 1)) second = 15; first = 5; else first = -10; second = -20; cout
// The ouput for code
#include <iostream>
using namespace std;
int main(){
int first = 16;
int second = 8;
if ((first / second == 2) || (second / first == 3)) {
second = 10;
first = 20;
}
else if ((first % second == 2 || second % first == 1)) {
second = 15;
first = 5;
}
else{
first = -10;
second = -20;
}
cout << "First: "<<first<<" & Second: " <<second;
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- 21. The five line bellow are used to determine the profit or loss of a sale based on the buying cost and selling result after a margin calculation. The correct order of the program is . 1n = int (input () ) 2 buycost - 1000 * n + 1000 3 sellResult - 1200 • n 4 if (sellPrice-buyPrice>0) : profit = True if (sellPrice-buyPrice<=0): profit = False 6. a. 1,2, 3, 4, 5, no line of code can be reversed b. 1, 2. 3, 4, 5. with line-1, line-2, line-3 can be reversed each other c. 1, 2. 3, 4, 5. with line-4 and line-5 can be reversed with line-6 and line-7 d. Line-4 untul line-7 must be in sequence but can be placed in any orderarrow_forwardWhat is the default return type of main function? a. void O b. No default type O c. int O d. floatarrow_forwardMad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways. Complete the program to read the needed values from input, that the existing output statement(s) can use to output a short story. Ex: If the input is: Eric Chipotle 12 cars the output is: Eric went to Chipotle to buy 12 different types of cars. 367012.2549490.qx3zqy7 LAB 2.14.1: LAB: Mad Lib 0/10 ACTIVITY LabProgram.java Load default template... 1 import java.util.Scanner; 2 3 public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String firstName; String genericLocation; int wholeNumber; String pluralNoun; 4 6 7 8 9 10 11 /* Type your code here. */ 12 System.out.println(firstName + } 13 went to + genericlocation + to buy + wholeNumber + differei 14 15arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education