a) Viết chương trình tính tổng từ 20 – 50

b) Viết chương trình tính tổng từ a – b, với a, b nhập từ bàn phím. Yêu cầu: a
không phải thông báo lỗi.

cứu tôi 2 câu này sài lệnh lặp

Answers

Answer 1

Answer:

Program viet_chuong_trinh_tinh_tong;

Uses Crt;

Var i,s:integer;

Begin

Clrscr;

i:=20;

While (i>=20) and (i<=50) do

Begin

s:=s+i;

i:=i+2;

End;

Writeln(S);

Readln;

End.

Explanation:


Related Questions

Write a program that prompt the user to enter a bank balance. The balance entered by the user is read into a variable named balance. The program then prompts the user to enter the amount to be deposited. The amount entered by the user is read into a variable named deposit. The program that calculates the new balance, which is the present balance plus the deposit. The program then displays the new balance.

Answers

Answer:

ertyuiopoijuhgfdsa hiyoufun tresdfghytrefgytredfg

Explanation:

look for the words

A color image uses 16bits to represent a pixel. What is the maximum number of different colors that can be represented?

Answers

Answer: A color image uses 16 bits to represent a pixel. What is the maximum number of different colors that can be represented? With 16 bits, we can represent up to 2^16 different colors. Assume six devices are arranged in a mesh topology.

Explanation:

The terms 16-bit picture, high color image, and 32K color image are all used to describe images that have 16 bits per pixel.

What is a pixel?

The smallest addressable element in a raster image or the smallest point in an all points addressable display device is known as a pixel (abbreviated as px), pel, or picture element in digital imaging.

The smallest component in most digital display systems that can be changed by software are pixels.

Photos with 16 bits per pixel are referred to as 16-bit pictures, high color images, and 32K color images.

The number of distinct colors that can be represented by 16 bits, where there are 5 bits for each of the red, green, and blue values and the 16th bit can be the alpha bit, is around 32 thousand.

Thus, the maximum number of different colors that can be represented is 32 thousand.

For more details regarding pixel, visit:

https://brainly.com/question/15189307

#SPJ2

9. In a program with 25% loads, 10% stores, 11% branches, 2% jumps, 52% R-type. The standard CPI for each instruction type is 2 cycles loads, 2 cycles stores, 1 cycle branches, 2 cycles jumps, 1 cycle R-type. The branches have a misprediction penalty of an additional 2 cycles when it misses, which happens 30% of the time. Loads create a RAW hazard 20% of the time adding in an extra cycle to the execution time. What is the average CPI for this program on this processor

Answers

Answer:

2.6

Explanation:

Does media contribute to the mental wellness of society?​

Answers

Answer:

However, multiple studies have found a strong link between heavy social media and an increased risk for depression, anxiety, loneliness, self-harm, and even suicidal thoughts. Social media may promote negative experiences such as: Inadequacy about your life or appearance.

How ever multiple studies show that

How do I get fix the code to make it input 3 values and get the correct output
-------------------------------------------------------------
12.20 LAB: Driving costs - functions

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value))

Ex: If the input is:

20.0
3.1599

the output is:

1.58
7.90
63.20

Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles.

Ex: If the function is called with:

50 20.0 3.1599

the function returns:

7.89975

def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon)

Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles.
---------------------------------------------------
I need help for this part
Ex: If the function is called with:

50 20.0 3.1599

how do I get it to input the three to get the output of 7.89975?
-------------------------------------
My code:

# Define your function here.
def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):
return (driven_miles/miles_per_gallon) * dollars_per_gallon

if __name__ == '__main__':
# Type your code here.

# Miles per gallon from input
miles_per_gallon = float(input())

#Dollars per gallon from input
dollars_per_gallon = float(input())


# Display the results as output

print('{:.2f}'.format(driving_cost(10, miles_per_gallon,dollars_per_gallon)))
print('{:.2f}'.format(driving_cost(50, miles_per_gallon,dollars_per_gallon)))
print('{:.2f}'.format(driving_cost(400, miles_per_gallon,dollars_per_gallon)))

Answers

Answer:Change your logic to:

for (int i = 0; i < 4; i++) {

System.out.println("Please input a number between zero to 3");

// use input and don't advance the scanner every time

int input = sc.nextInt();

if (input == 0) {

System.out.println("You have selected " + right);

}

if (input == 1) {

System.out.println("You have selected " + left);

}

// so on and so forth

}

By using sc.nextInt() four times, you are looking for the next token of the input which isn't there. So fetch the input for each run of the for-loop and it will work as expected.

Explanation:

Given the following code, what logic would you need to include to print all even values stored within the array:

int[] myArray = {1,2,38,4,54,6,7,8,9,10};

for (int i = 0; i < myArray.length; i++) {
//your code goes here
}
NOTE: Your response should be just the missing logic--not the entire problem set.

Answers

The missing logic whigh would allow all the even numbers stored within the array to be printed is if(myArray[i]%2 == 0)

Even numbers are divisible by 2, and hence, will leave no remainder when divided by 2.

Using the modulo operator, each iterated value in the array should be checked if it has a remainder of 0, when divided by 2.

Hence, if the remainder is 0, then the value is even and the value should be printed.

Learn more : https://brainly.com/question/17330574

Your worksheet contains a price in cell A5 and many formulas refer to that price how would you refer to that price in the formula

Answers

Answer:

$A$5

Explanation:

The A$5 would allow the row part of the reference to stay in place but would allow the column to change.

What does '$' mean in Excel formula?

An absolute reference in Excel exists as a cell address with the dollar symbol ($) in the row or column coordinates, like $A$1. The dollar sign specifies the connection to a given cell so that it stays unchanged no matter where the formula moves.

The A$5 would permit the row position of the authority to remain in place but would permit the column to modify. The location of the $ before either the row or column or both exists what specifies what component stands frozen. Therefore, the correct answer is option b) $A$5.

Complete question:

Your worksheet contains a price in cell A5, and many formulas refer to that price. How would you refer to that price in the formulas?

a. A5

b. $A$5

c. $A5

d. A$5

To learn more about Excel formula

https://brainly.com/question/26276255

#SPJ2

Other Questions
Latrice and Camille just became college roommates. They decide to attend a party on campus to get to know the other students. On their way, a man driving a dark van slows down alongside them, offering them a ride. Camille is hesitant but Latrice boldly declines and confidently pulls Camille farther away from the road. If you were a subscriber to Stark's theory of deviant places, what statement would you MOST likely say is true? OA. Camille is from a bad neighborhood where crime occurs regularly and is rarely afraid. B. Latrice has been exposed to an area where crime is prevalent and knows how to avoid it. C. Latrice has been raised in a safe area where there is little reason to doubt strangers. D. Camille is an exchange student who does not understand English well. A drama in which the characters and setting are presented in typical and real-world ways is known as: Shade 0.25 of the design. Write a fraction in simplest fotm to represent the shaded part of the design please help I will make you Brainliest Which statement is true based on the two labels? Product A has 5 grams of protein.Product B has 6 grams of sugar.Product A has a serving size of 1 gram.Product B has fewer calories than Product A. MARKING BRAINLIEST :)Which property has a trend similar to that of electronegativity? A. First ionization energy B. Atomic radius C. Ionic radius D. Atomic mass Which of the following expressions has the greatest value? Copia las palabras primitivas: peluquero flauta secador pianista menedero cristal the origin and development of the atlantic ocean can be attributed to a divergent movement along the boundary known today as the what is 0.08 as a percent. Was ist richtig? Kreuzen Sie.Die Katze liegt _____________ Stuhl und schlft. 1)unter den2)unter demEs darf kein Mll __________ Briefkasten liegen.1) auf die2) auf demWarum hast du das Schild __________ Tr gehngt?1) an die2) an der Which of the following newspaper headline would you NOT find on newsstands after theConstitutional Convention?"National government reigns supreme!""Population based on Representation and equality!"O "Slavery finally abolished in new Constitution!"Checks and Balances helps the three branches stay equal!" 2 ( -2 ) -83 ( -3 ) -185 ( -1 ) Ayudaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa :( HI GUYS COULD SOMEONE PLEASE HELP ME???I REALLY NEED HELP ILLL GIVE BRAINLIEST I JUST REALLY NEED TO FINISH find the inverse of -3y+5x=18 When an elastic object is changed from its original shape:A:Energy is releasedB:Work is doneC:It is ruinedD:It makes a twanging sound 2.What are some common themes among alternative approaches ?Constructivism , conflict and inequality . A proton is released in a uniform electric field and it experiences an electric force of 2.18x10^-14N toward south .What are the magnitude and direction of the electric field whats your favorite subject and are you doing good in school The city council of a small town wanted to add fluoride to their water so that all the residents would have healthier teeth. The mayor had read that ionic compounds must be used to get the fluoride into water. He looked up fluorine-containing compounds and came up with the following list. NaF NF3 SiF4 CaF2 NH4FUsing academic vocabulary in paragraph form, discuss the following: Explain which compound(s) could produce fluoride ions in the water. In your response, be sure to include: which of the listed compounds are ionic and which are covalent. how ionic and covalent compounds are different. why only ionic compounds would produce fluoride in water.