20.11.2014 Views

OHJELMOINTITEKNIIKKA

OHJELMOINTITEKNIIKKA

OHJELMOINTITEKNIIKKA

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Esimerkki (parametrit)<br />

public class Keskiarvo1 {<br />

public static void laskeKeskiarvo(int eka, int toka){<br />

double c;<br />

c = (eka+toka)/2.0;<br />

System.out.println("Keskiarvo on "+c);<br />

}<br />

}<br />

public static void main(String[] args){<br />

int luku1, luku2;<br />

System.out.print("Anna luku1: ");<br />

luku1 = Lue.koko();<br />

System.out.print("Anna luku2: ");<br />

luku2 = Lue.koko();<br />

laskeKeskiarvo(luku1, luku2);<br />

}<br />

116

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!