Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- /**
- * @param args
- */
- public static void main(String[] args) {
- double test = exp(10, 3);
- // Hier sagt er mir die Methode exp(int,int) ist nicht
- //für definiert für "type Main"
- System.out.println(test);
- }
- static double exp(int basis, int potenz){
- if(potenz == 0){
- double a = 1;
- return a;
- }
- else{
- double a = 1;
- for(int i = 0; i <= potenz; i++){
- a = a *basis;
- }
- return a;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement