.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Programmazione (http://www.dsy.it/forum/forumdisplay.php?forumid=259)
-- [Alberti] Secondo Compitino (http://www.dsy.it/forum/showthread.php?threadid=23184)


Posted by dafth on 15-12-2005 11:34:

[Alberti] Secondo Compitino

Sono uscite le risposte del secondo compitino, nell'esercizio numero 6 al 3° ciclo io mi trovo risultati diversi, per la precisione
num1 :1
num2 :14
num3 :10

ho anche scritto il codice e testato ed il risultato è sempre lo stesso

code:
public static void main(String arg[]) { final int MIN=3, LIMIT=6; int num1 =1 , num2=5, num3=9; do num2 += num3++; while (num3< LIMIT); System.out.println("num1 :"+num1); System.out.println("num2 :"+num2); System.out.println("num3 :"+num3); }

Mentre nel pdf della prof il risultato è:
num1 :1
num2 :13
num3 :10

Cosa ne pensate?? Avete lo stesso risultato voi?


Posted by johnnyd on 15-12-2005 16:13:

emh...
io ho tenuto conto che i cicli fossero in sequenza quindi ho tutti i risultati sfasati tranne per il primo.!

Che nervi...

__________________
My Blog - My Photo Album


Posted by Antonio86 on 15-12-2005 19:08:

A me viene 14 anche matematicamente, sarà un errore di battitura

__________________
You byte the hand that feeds you


All times are GMT. The time now is 07:01.
Show all 3 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.