Question

write a line code to check if the variable x is greater than 20

write a line code to check if the variable x is greater than 20

Homework Answers

Answer #1

Code in c language:

#include <stdio.h>

int main()
{
    int x=30;
    
    if(x > 20)
    {
        printf("Variable x is greater than 20");
    }
    else
    {
        printf("Variable x is less than 20");
    }
    
    printf("\n\nCompare using Ternary Operator\n");
    (x>20)?printf("Variable x is greater than 20"):printf("Variable x is less than 20");
    
    return 0;
}

Output:

.

Know the answer?
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
Similar Questions
Python: Provide code and result Given 4 values x, y, s, and t. Write a one-line...
Python: Provide code and result Given 4 values x, y, s, and t. Write a one-line command to check if x > y or s > t. If yes, the code should output "True" We try to define a function in Figure 2, please identify two problems with the code. Write an inline if statement to assign x the value 1 if the variable y = 'female' and assign x the value 0 if the variable y = 'male'. The...
The following code should print X is greater than 0. However, the code has errors. Fix...
The following code should print X is greater than 0. However, the code has errors. Fix the code so that it compiles and runs correctly. (Rewrite the program with all the fixes) public class Test1 { public static void main(String[] args) { int x = 3; if (x > 0 System.out.println("x is greater than 0") else System.out.println(x is less than or equal 0"); } } Must be in java and easy to understand grade 11 course
For X~N(100, 20) - 40 is greater than or equal to__ 60 is greater than or...
For X~N(100, 20) - 40 is greater than or equal to__ 60 is greater than or equal to__ of values. 80 is less than or equal to__ of values.
Write the following as an inequality. 9 is greater than or equal to x, and 1...
Write the following as an inequality. 9 is greater than or equal to x, and 1 is less than or equal to  x Use x only once in your inequality.
After running the code check a line by line from 1 to 13 in Console what...
After running the code check a line by line from 1 to 13 in Console what each line of the code does? ( Clearly explain what each line mean with examples ) ?? 1-x<-rnorm(100, 3,2) 2-mean(x) 3-var(x) 4-y<- -2.5*x 5-mean(y) 6-var(y) 7-par(mfrow=c(1,2)) 8-hist(y, xlab='', main='Histogram Y') 9-boxplot(y, ylab="Y Sample", main='Boxplot Y') 10-abline(h=mean(y), lty=2) 11-#qqnorm(y, pch = 19) 12-#qqline(y, col = "steelblue", lwd = 2) 13-par(mfrow=c(1,1))
Let Y ∼ Unif(1, 5) R1. Write code in R that will simulate the setup in...
Let Y ∼ Unif(1, 5) R1. Write code in R that will simulate the setup in question 3a, and hence, allow you to roughly check your answer. 3a. If you generate 5 random numbers based on Y , what is the probability you’ll get more (numbers greater than 4) than (numbers less than or equal to 4)? R2. Write code in R that will simulate the setup in question 3b, and hence, allow you to roughly check your answer. 3b....
Write the below code to use HTML and JavaScript. 1)Write a JavaScript program to create a...
Write the below code to use HTML and JavaScript. 1)Write a JavaScript program to create a new string from a given string changing the position of first and last characters. The string length must be greater than or equal to 1. 2)Write a JavaScript program to check whether a string starts with 'Java' and false otherwise
Write the logical expression to extract blood.glucose greater than 10 and short.velocity greater than 1.5 in...
Write the logical expression to extract blood.glucose greater than 10 and short.velocity greater than 1.5 in the thuesen data set (Using R)
If X is a normal random variable that has a mean of µ = 20 and...
If X is a normal random variable that has a mean of µ = 20 and a standard deviation σ = 2, (a) the standardized value of X=16 is _________. (b) What is the probability that X is less than or equal to 16? __________ (c) What is the probability that X is greater than 16? __________ (d) What is the probability that X is equal to 16?________
Write the equation of the tangent line to the graph of y = (x^2 − 16x)/(4x...
Write the equation of the tangent line to the graph of y = (x^2 − 16x)/(4x − x^3) at x = 4. Check the reasonableness of your answer by graphing both the function and the tangent line