Answer:
x = int(input("Enter an integer: "))
y = int(input("Enter another integer: "))
if x > y:
for number in range(y+1, x):
print(number, end=" ")
elif y > x:
for number in range(x+1, y):
print(number, end=" ")
else:
print("There are no integers between {} and {}".format(x, y))
Explanation:
*The code is in Python.
Ask the user to enter the two integers, x and y
Since we want our program to run regardless of which entered value is larger, we need to compare the numbers to be able to create the loop that prints the numbers.
Check if x is greater than y. If it is, create a for loop that iterates from y+1 to x-1 and print the numbers
Otherwise, check if y is greater than x. If it is, create a for loop that iterates from x+1 to y-1 and print the numbers
If none of the previous part is executed, print that there are no integers between
Answer:
The program in python is as follows:
import math
def traj ect ory(th e ta,x,y,v):
t = ma th . tan(m ath . radians(theta))
c = math . cos(math . radians(theta))
g = 9 . 8
fx = x * t - (1/(2*v**2)) * ((g*x**2)/(c**2))+y
return round(fx,3)
print("x\t f(x)")
for x in range(0,17):
theta = 50
y= 10
v = 10
print(str(x)+"\t"+str(tr aje ctory (the ta,x,y,v)))
Explanation:
The question is incomplete. However, I have written the program to calculate the trajectory values f(x).
<em>See attachment for complete program where comments were used as explanation</em>
Answer:
Data Flow Diagram
Explanation:
Data flow diagram is representation of data which is processed in terms of input and output.It is a tool for designing the structure for a software.Rectangles,square and circles are used in representing the flow of information.
DFD consists two components
- Layers-It consist many layers,the top layer is called context diagram.
- Levels-The first level shows the main process of the system.
Answer:
function moves(a) {
var left = 0;
var right = a.length-1;
var count = 0;
while (left < right) {
if(a[left] % 2 == 0) {
left++;
continue;
}
if(a[right] % 2 == 1) {
right--;
continue;
}
var temp = a[left];
a[left] = a[right];
a[right] = temp;
left++;
right--;
count++;
}
return count;
}
var a = [4,13,10,21,20];
console.log('Number of moves: ' + moves(a));
console.log('Sorted array: ' + a);
Explanation: