1. the value of expression 18 % 5 is _?
2. write the conditional statements in C++ to solve the following problem. declare variables properly.
a. get a number for a month from the keyboard
b. if a month is 1,2,3, print out "quarter 1" to the monitor
c. if a month is 4,5,6, print out "quarter 2" to the monitor
d. if a month is 7,8,9, print out "quarter 3" to the monitor
e. if a month is 10,11,12, print out "quarter 4" to the monitor
1.
the value of expression 18 % 5 is 3
2.
conditional statements in C++ to solve the given problem
int month;
cout<<"Enter month: ";
cin>>month;
if(month>=1 && month<=3)
cout<<"quarter 1";
else if(month>=4 && month<=6)
cout<<"quarter 2";
else if(month>=7 && month<=9)
cout<<"quarter 3";
else if(month>=10 && month<=12)
cout<<"quarter 4";
1. the value of expression 18 % 5 is _? 2. write the conditional statements in...
matlab only
Question 5: a.) Write an m-file using conditional statements to evaluate the following function, assuming that the scalar variable x has a value. The function is for x <-1 - 3e y=2+cos(m) for-1 x<5 y 10-5)+1 for r 2 5 Use your file to evaluate y for x5, x-3, and x-15, and Use keyboard entry for values of x. b.) Use a for loop in the above file to plot the above function over the interval -2x <10....
Multiple Conditional Statements Summary In this lab, you complete a Python program that calculates an employee's annual bonus. Input is an employee's first name, last name, salary, and numeric performance rating. If the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. If the rating is 4 or higher, the rate is 0. The employee bonus is calculated by multiplying the bonus rate by the annual salary. Variables have been declared for you,...
Problems 9-35 odd numbers only(9,11,13,15 …35)
k newNum numi (int) (4.6/2)1 . Do a walk-through to find the value assigned to e. Assume that all variables are properly declared. a -31 es" (a%b) * 6; e-(a b+ d)/ 4 10. Which of the following variable declarations are correct? If'a variable declaration is not correct, give the reasoníy) and provide the correct variable declaration. n = 12; char letter int one = 5, two; //Line 3 double x, Y zi //tine...
in C
The preceding LML program reads two numbers from the keyboard and determines and prints the larger value. Note the use of the instruction +4107 as a conditional trans- fer of control, much the same as C's if statement. In-Class Tasks Write LML programs that accomplish each of the following tasks: Use a sentinel-controlled loop to read 10 positive integers and compute and print their sum 1. 2. Use a counter-controlled loop to read seven numbers, some positive and...
use 18 rules of inference to solve the following problem. Do not use conditional proof, indirect proof, or assumed premises.for each proof you must write the premises in that proof. 1. X v Y prove /S v Y 2. z 3.( x•z)---> s
Write a C program that will do the following: 1.Declare four integers variables. intVar1, intVar2, intVar3,and intVar4. 2. Initialize intVar1 to the value 4; initialize intVar2to the value 5. 3. Declare four more integer variables. exp1, exp2,exp3, and exp4. 4. Declare a character variable charVar. 5. Assign the value of each expression below to variables exp1and exp2 respectively: exp1= intVar1 + ((5 * intVar2) / (3 * intVar1)); exp2 = intVar1 + (5 * (intVar2 / 3)) * intVar1; 6....
For 1 through 11, create an expression using the relational operators, the logical operators, and variable names of your own choosing, no if or variable declaration is necessary. 1. is a person's age equal to 30? 2. is a body temperature greater than 98.6? 3. is a person's height less than 6 feet? 4. is the current month 12? 5. check if the letter input is m 6. is a person's age equal to 30 and is the person taller...
Problem 2. For the following statements, write down whether true or false (No justification needed, and for ease of grading, please make it clear what is) (1) (a) xE (b) х€ {{x}} (c) x}€{{x}} (d) } E (2) (a) C 1,2,3 (b) E {1,2,3 (c)E P({1,2,3} (d) n0 (3) (a) 1,2,3 (b) {1,2,3} с {1, 2, 3} (c) An0 (d) AU A (4) a) ZnZ = Z (b) ZUZ 22 your answer Problem 3. List the elements of the following...
Write Python code examples of statements to remove the name at position 2 from the list in problem 32, and to remove one of the remaining names by referencing that name. Write Python code to declare a tuple named stuck that holds the three remaining names from famfri by referencing those names as elemens of famfri. Declare a Python set containing the names of the four seasons. What happens if you declare a set using a list that contains two...
use java and write in text
a. Rewrite the following code segment using if statements. Assume that grade has been declared as of type char. char grade= 'B';; switch (grade) { case 'A': System.out.println("Excellent"); break case 'B': System.out.println("Good"); default: System.out.println("you can do better”); } - b. write Java code that inputs an integer and prints each of its digit followed by ** e.gif the integer is 1234 then it should print 1**2**3**4 e.g. if the integer is 85 then it...