Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.java > #9291

perchè mi restituisce un intero?

Path csiph.com!aioe.org!.POSTED.hqPgifCF1TaqUfx+6Uvsxg.user.gioia.aioe.org!not-for-mail
From Pino <utr1utr@gmail.com>
Newsgroups it.comp.java
Subject perchè mi restituisce un intero?
Date Sun, 2 Jun 2019 00:48:45 +0200
Organization Aioe.org NNTP Server
Lines 27
Message-ID <qcuvcq$u82$1@gioia.aioe.org> (permalink)
NNTP-Posting-Host hqPgifCF1TaqUfx+6Uvsxg.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding 8bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
Content-Language it
X-Notice Filtered by postfilter v. 0.9.2
X-Mozilla-News-Host news://nntp.aioe.org:119
Xref csiph.com it.comp.java:9291

Show key headers only | View raw


Nel codice seguente,se assegno 10 e 3 ai due interi, la divisione mi 
restituisce 3.0  anzichè  3.333333

Come mai?

grazie


public class dividi {
	
	double divisione = 0.0;
	public static void main(String[] args) {
	  Scanner input = new Scanner(System.in);

			System.out.print("primo numero? ");
		int n1 = input.nextInt();
		

		System.out.print("secondo numero? ");
	int n2 = input.nextInt();
	
	double divisione =  n1/n2;
	System.out.print("disione :" + divisione );
	
	input.close();
}
}

Back to it.comp.java | Previous | NextNext in thread | Find similar


Thread

perchè mi restituisce un intero? Pino <utr1utr@gmail.com> - 2019-06-02 00:48 +0200
  Re: perchè mi restituisce un intero? "Dr.UgoGagliardelli" <do.not.spam@me.please> - 2019-06-02 01:18 +0200
    Re: perchè mi restituisce un intero? Pino <utr1utr@gmail.com> - 2019-06-02 15:06 +0200

csiph-web