What operator is used for \"less than or equal to\" in the condition of a loop?
ID: 3808289 • Letter: W
Question
What operator is used for "less than or equal to" in the condition of a loop? How can "less than or equal" be written using the > (greater than) sign? For example, re-write x. What operator is used for "greater than or equal to" in the condition of a loop? What operator is used for AND, using short-circuit analysis? What operator is used for OR, using short-circuit analysis? What is the syntax of an if-else statement (compare x to 5 as an example. Output whether x is greater or less than 5)? What is the syntax of a switch-statement (Use the example of passing an integer one through four, outputting the word that represents the number)? What are the valid data types for a switch statement? Construct an if-statement that outputs "hot" if the temperature is above 90-degrees and "cold" if the temperature is below 55-degrccs. Use the integer temp as your temperature variable. Construct a switch-statement to calculate the cost of produce: 1 - grapes @ $1 .99/lb 2 - strawberries @ $1.50/lb. 3 - apples @ $0.99/lb. Use int produce and double pounds as your produce and weight variables. A while-loop is a __-controlled loop A for-loop is a __ -controlled loop One execution of a loop block is called what? A while-loop that never evaluates to false is said to be in what? True or False: a for-loop executes a fixed number of times? Which type of loop - for-loop or while loop- is used when we don't know how many iterations are to be performed? for(i - 0: 2:20) executes how many iterations? while(x 11) while(yExplanation / Answer
1. what operator is used for "less than or equal to": <=
2. x <=10 can be writeen as !(x > 10)
3. operator for greater than equal to condition: >=
4. operator for AND, usign short circuit analysis: &&
5. operator for OR, usign short circuit analysis: ||
6. if(x < 5) {
print("x is less than 5");
} else {
print("x is greater or equal to 5");
}
7. switch(a) {
case 1:
// statements
// break;
case 2:
// statements
// break;
case 3:
// statements
// break;
case default:
// statements
// break;
}
Valid data types are char and int.
8. if(temp > 90)
print("hot");
else if(temp < 55)
print("cold");
I have tried to answer maximum question whatever i can do in the given time limit... i would request you to please post the questions in smaller numbers, as its not possible to answer so many question.. that too by typing so much. Please post other questions in seperate thread, and we would surely answer.
Thanks!!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.