Zadanie51D

Zadanie51D



File Edit Search Markers Folding View Utilities Macros Plugins Help

O Zadanie51D.java (D:\StraznikTeXasu\UMCS\java\Prog1\)

// REKURENCJA. inuort java.io.*;.

public class Zadanie51D{.

public static int pobierzLiczbe(String komunikat){ // funkcja do pobiec Console konsolka = System.console();.

return Integer.parseInt(konsolka.ceadLine(komunikat));.

}•

public static int wyrazD(int n){. int wynik;. if (n = 0) {. wynik = 1;.

} else if (n % 2 != 0) {.

wynik = 2*wyrazD(n-1);.

} else {.

wynik = 2*wyrazD(n-1) + 1;.

};.

return wynik; // zwracamy wynik!.

}•

public static void main(String[] argumenty) int numer;.

numer = pobierzLiczbe("Podaj n: ");.

System.out.println("n-ty wyraz wynosi " + wyrazD(numer));.

}•

>

ania danych.

A.

.

'V1 b


i

18,28 Ali


(java.none,Cp125Q)-



Wyszukiwarka

Podobne podstrony:
17686 Zadanie21 File Edit Search Markers Folding View Utilities Macros Plugins Help □łńHS>^ ££$ 0
Zadanie51B File Edit Search Markers Folding View Utilities Macros Plugins Help □łńHS>^ ££$ 0 04-0
17686 Zadanie21 File Edit Search Markers Folding View Utilities Macros Plugins Help □łńHS>^ ££$ 0
80576 Zadanie51B File Edit Search Markers Folding View Utilities Macros Plugins Help □łńHS>^ ££$
Zadanie19 1] jEdit - Zadaniel9.java^ File Edit Search Markers Folding View Utilities Macros Plugins
Zadanie20 File Edit Search Markers Folding View Utilities Macros Plugins Help ££! OO^OO coe pmmm Q
Zadanie22 File Edit Search Markers Folding View Utilities Macros Plugins Help ££! oo^oo pmmm i^u Q
Zadanie112 File Edit Search Markers Folding View Utilities Macros Plugins Help oo^oo pmmm i^u Q ©
Program File Edit Search Markers Folding View Utilities Macros Plugins Help fiS 0 04-0 0 : - tf
Program jEdit - Program_09.java File Edit Search Markers Folding View Utilities Macros Plugins Help

więcej podobnych podstron