Answer the following questions 1. Rewrite the following code using one if-else statement if (let1 ==’B’) printf(“This is B\n”) if (let !=’B’) printf (“This is not B \n”); Answer:
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Answer the following questions
1. Rewrite the following code using one if-else statement if (let1 ==’B’) printf(“This is B\n”) if (let !=’B’) printf (“This is not B \n”);
|
Answer: |
2. Given that x=5 and y=- 10, what is the output of this code If (x>10 && y<x-5) { If (x || y) x = 9; } else y =10; printf(“%d %d”, y,x); ? (Explain) |
Answer: |
3. Write the code to check if y is between 80 and 100 (including 80 and not including 100)? |
Answer: |
4. Given that x = 2, what is the output of this code #include <stdio.h> int main (void) { int x; printf ("enter an integer number between 0 and 2\n"); scanf("%d",&x); switch (x) {case '0': printf(" the number is low\n"); break; case '1': printf("the number is ok\n"); case '2': printf("the number is high\n"); } } |
Answer: |
5. In which cases you can transform an else-if statements to switch? Provide an example. |
Answer: |
Step by step
Solved in 3 steps with 2 images