A) write a single c statment the do the following:
1) define two integr variables x and y
2) display the message "enter two numbers"
3) obtain values for varibles x and y from the kayboard
4) test if the currnet value of varable y is greater than the current value of variable x
B) dfine a function that calculate the lengthe of hypotenuse of a right trinangle when the other two sides are given
A) write a single c statment the do the following:
1) define two integr variables x and y
int x, y;
2) display the message "enter two numbers"
printf("enter two numbers");
3) obtain values for varibles x and y from the kayboard
scanf("%d %d", &x, &y);
4) test if the currnet value of varable y is greater than the current value of variable x
if(y > x) { }
B) dfine a function that calculate the lengthe of hypotenuse of a right trinangle when the other two sides are given
double hypotenuse(double x, double y) {
return sqrt(x*x + y*y);
}
A) write a single c statment the do the following: 1) define two integr variables x...
Problems: 1. Write a program to define the following variables, assign them values, and print their values on screen: Integer x = 20, Float y = 40.45 Double z = 91.51e+5 Char w = A • • For the integer variable x, you need to print it in decimal notations, octal notations and hexadecimal notation. For the double variable y, you need to print it in double notations and scientific notation. 2. Write a program with the following three parts:...
*****language : java****** ceate a class RightTriangle with three instance variables of type double called base, height, and hypotenuse and three instance variables of type int called ID, xLoc and yLoc. Also add a static variable of type double called scaleFactor. This should be initialized to a default value of 1. Then define an appropriate constructor that takes initial values for all instance variables except hypotenuse and sets the values of all instance variables including calculating the hypotenuse. Then define...
Create a class Circle with one instance variable of type double called radius. Then define an appropriate constructor that takes an initial value for the radius, get and set methods for the radius, and methods getArea and getPerimeter. Create a class RightTriangle with three instance variables of type double called base, height, and hypotenuse. Then define an appropriate constructor that takes initial values for the base and height and calculates the hypotenuse, a single set method which takes new values...
2. a)Write the ARM ALP conditional code snippet for the following statements written in C-language. Assume R1 to Rn as06 variables Let R1, R2, R3 contain the starting addresses of arrays X, Y and Z respectively Use Register R4 for variable i. Display appropriate messages. While (i+10) else Z[i] XiYi; b)i Write a program to display a message "This is an examination Question" on the screen using 06 a function sub program Note the following Address of the string to...
C language not C++
1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct int x; float y; char zi var1; union nt x; float y; char[20] z;) var2 f float and int are stored using 4 bytes each, what is the size (in bytes)...
Let X and Y be two independent Bernoulli( 1/2 ) random variables. Define random variables U and V by U = X + Y and V = | (X - Y) | (abs. value)): (a) Find the joint probability mass function of (U, V ). Hints: note that U and V are taking integer values in {0, 1, 2} and {0, 1}, respectively. (b) Determine the covariance Cov(U, V ): (c) Find Var(U), Var(V ) and determine the correlation coeffcient p(U,...
Write a single C++ statements to accomplish each of the following tasks: In one statement, assign the sum of the current value of x and y to z and postincrement the value of x. Determine whether the value of the variable count is greater than 10. If it is, print “Count is greater than 10.”. Pre-decrement the variable of x by 1, then subtract it from the variable total. Multiply variable power by x and assign the result to power. ...
Lab 7 Add three instance variables to your class RightTriangle from lab 5. The first two are of type int and are called xLoc and yLoc and the third is of type int called ID. Also add a static variable of type double called scaleFactor. This should be initialized to a default value of 1. Update the constructor to set the three new instance variables and add appropriate get and set methods for the four new variables. All set methods...
Write code in C to demo how to test the content of a variable and do some action accordingly. Add a one line comment above the code to explain the code. Here is an example: /* the following code checks if variable x is divisible by variable y and displays a message accordingly */ int x,y; printf( "Enter two numbers \n" ); scanf("%d %d",&x,&y); if (x % y ==0) { // use == to test for equality % returns remainder...
I am supposed to a pseudocode function named max that accepts two integer values as arguments and returns the value that is greater of the two. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is greater of the two. Is everything correct and complete? //Pseudocode //This function takes two integers as parameters: x and y Begin : Max(x,y) If(x>y) then MAX=x Else MAX=y End if Return...