Question

3-How would you write the following using C code? X is equal to Y   (comparing X...

3-How would you write the following using C code?

  1. X is equal to Y   (comparing X and Y not setting X to the value of Y)
  2. X is not equal to Y
  3. A is less than or equal to B
  4. Q is not greater than T
  5. X is greater than or equal to Y
  6. X is less than or equal to Y and A is not equal to B
  7. A is greater than 18 and H is greater than 68 and W is greater than 75
  8. G is less than 100 and greater than 50.
  9. H is less than 50 or greater than 100.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a X is equal to Y   (comparing X and Y not setting X to the value of Y)

if(x==y){ }

b X is not equal to Y

if(x!=y){ }

c A is less than or equal to B

if(A<=B){ }

d Q is not greater than T

if(Q>!T){ }

e X is greater than or equal to Y

if(X>=Y){ }

f X is less than or equal to Y and A is not equal to B

if(X<=Y && A!=B){ }

g A is greater than 18 and H is greater than 68 and W is greater than 75

if(A>18 && H>68 && W>75) { }

h G is less than 100 and greater than 50.

if(G<100 && G>50) { }

i  H is less than 50 or greater than 100.

if(H<50 || H>100) { }

Add a comment
Know the answer?
Add Answer to:
3-How would you write the following using C code? X is equal to Y   (comparing X...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ Given the following code: int number = 50; Write the if statement to print “yes” and add...

    c++ Given the following code: int number = 50; Write the if statement to print “yes” and add one to the number variable if the value stored in the number variable is greater than 50 or less than or equal to 75.

  • Write a section of Java code using while, do-while and for loops Write a section of...

    Write a section of Java code using while, do-while and for loops Write a section of Java code that will print out random integers between 1 and 100 while N is less than or equal to 5. Sample output > random # 1 is: 73 random # 2 is: 68 random # 3 is: 76 random # 4 is: 64

  • How would you write code in R studio for: Step 2: In a new code chunk...

    How would you write code in R studio for: Step 2: In a new code chunk below the last, write code that will create a subset of the data containing just the name, height and weight columns for males that are no more than 48" tall (Southpark fitness data) or no more than 68" tall (your own lab 1 fitness data). Step 3: Below the last code, write another command that will create a dataframe with just the name, time,...

  • MATLAB Define the following computer programming terms and give an example of each. MATLAB example Sequence...

    MATLAB Define the following computer programming terms and give an example of each. MATLAB example Sequence Selection structure- Repetition structure - Relational operators (True = 1, False = 0) Logical operators (True = 1, False =0) And Or Less than Less than or equal to Greater than Greater than or equal to Equal to Not equal to Not ans ans Type the following relational operator commands into MATLAB in the command window one at a time. Write the results to...

  • What will be the output of the following code int x = 5; int y =...

    What will be the output of the following code int x = 5; int y = 2; f(x,y); printf(“%s \n”, (x/y > 2) ? “x is more than two times larger than y” : “x is less than or equal to 2*y\n ”); f(int x, int y) { x = 2*y; printf(“%s \n”, (x/y > 2) ? “x is more than two times larger than y” : “x is less than or equal to 2*y \n”); } a. x is...

  • Write a MATLAB program to accomplish the following: Create a variable x by assigning it the...

    Write a MATLAB program to accomplish the following: Create a variable x by assigning it the value 5. Then, subtract 8 from the square of x and assign the result to a second variable y. Next, create a vector z containing as values all the positive prime integers greater than or equal to 2 and less than 20. Multiply z by two and subtract y, and assign the result to w. ONLY display the value for w in the Command...

  • Project: 2D, S/S Heat Conduction in a Rectangle with Heat Generation Write a code in MATLAB that ...

    Project: 2D, S/S Heat Conduction in a Rectangle with Heat Generation Write a code in MATLAB that can calculate the temperature inside a thin, rectangular, metal plate, T(x, y) at some selected points as shown in the figure. The temperatures at the boundaries are constant and there is heat generation inside the plate. The problem is steady- state and k = 100 W/(m·K) with L = 1m and H = 0.5 m. The equation to be solved is, 50 °C...

  • CODE IN C++ 13.5 Alphabet Histogram Write a program that reads input character by character from...

    CODE IN C++ 13.5 Alphabet Histogram Write a program that reads input character by character from the given data file "data.txt" The program should be case insensitive and count the number of occurances of each character in the alphabet. It should print a histogram of the results as follows: A : B : C : * D : * E : * F : G : H : I : J : * K : L : M : N...

  • 2. What is the value of x alter the following code is executed # include<iostream> using...

    2. What is the value of x alter the following code is executed # include<iostream> using namespace std; int main int t-0, c- 0,x-3; while (c < 4) t=t+x; cout << x return 0; a) 3 b) 21 c) 24 d) 48 3. What is the output of the following code? # include<iostream> using namespace std; int main0 int a- 3; for (int i 5; i >0; i) a a+i cout << a << “ “ return 0; d) 8...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT