• Non ci sono risultati.

Programming, control structures

N/A
N/A
Protected

Academic year: 2021

Condividi "Programming, control structures"

Copied!
9
0
0

Testo completo

(1)

Programming, control structures

Loriano Storchi

loriano@storchi.org

http:://www.storchi.org/

(2)

EXECISE

(3)

FLOWCHART AND PSEUDOCODE

Calculate the Interest of a Bank Deposit

Step 1: Read amount, Step 2: Read years, Step 3: Read rate,

Step 4: Calculate the interest with formula

"Interest=Amount*Years*Rate/100

Step 5: Print interest,

(4)

FLOWCHART AND PSEUDOCODE

Calculate the Interest of a Bank Deposit

(5)

FLOWCHART AND PSEUDOCODE

Determine and Output Whether Number N is Even or Odd

Step 1: Read number N,

Step 2: Set remainder as N modulo 2, Step 3: If remainder is equal to 0 then number N is even, else number N is odd,

Step 4: Print output.

(6)

FLOWCHART AND PSEUDOCODE

Determine and Output Whether Number N is Even or Odd

(7)

FLOWCHART AND PSEUDOCODE

For a given value, Limit, what is the smallest positive integer Number for which the sum Sum = 1 + 2 + ... + Number is greater than Limit. What is the value for this Sum?

1. Enter Limit

2. Set Number = 0.

3. Set Sum = 0.

4. Repeat the following:

a. If Sum > Limit, terminate the repitition, otherwise.

b. Increment Number by one.

c. Add Number to Sum and set equal to Sum.

5. Print Number and Sum.

(8)

FLOWCHART AND PSEUDOCODE

An infinite loop in python:

(9)

FLOWCHART AND PSEUDOCODE

For a given value, Limit, what is the smallest positive

integer Number for which the sum Sum = 1 + 2 + ... +

Number is greater than Limit. What is the value for this

Sum?

Riferimenti

Documenti correlati

La nomenclatura degli acidi carbossilici usa la desinenza –oico e la radice della catena più lunga contenente il gruppo

○ Se i raggi emessi da una famiglia di piani sono fuori fase (come nel caso di angolo di incidenza arbitrario) non viene prodotto un fascio rinforzato. ○ Se i raggi

● I gruppi di atomi di dimensione maggiore della dimensione critica sono chiamati nuclei.. La dimensione critica e’ il risultato dell’equilibrio tra energia libera di

“velocemente” (35% Ni e 65% Cu) La formazione di strutture ed il riarrangiamento delle composizione della fase solida e liquida durante il raffreddamento e’ un

● Unita’ monomeriche, come l’etilene, che possono formare due legami covalenti, e quindi catene lineari sono dette “bifunzionali”.. ● Ci sono unita’ monomeriche

Come abbiamo visto ovviamente dovremmo avere una specie che si riduce, molti metalli vengono corrosi da acidi in questo caso la reazione di riduzione e’ quella che

Dal punto di vista della teoria delle bande si crea una livello nella zona proibita vicino alla banda di valenza (accettore) facilmente popolabile (elettrone eccitato lascia

Misura la capacita’ di un materiale di assorbire calore, quindi unita’ di energia richiesta per produrre l’aumento di unita’ di temperatura.. C