All pastes #927211 Raw Edit

Stuff

public text v1 · immutable
·published 2008-03-04 02:39 UTC
rendered paste body
import javax.swing.JOptionPane;

public class RecursiveTest{
	public static void main (String args[]){
		int result, b, e;
		b = Integer.parseInt(JOptionPane.showInputDialog("Enter the base value :"));
		e = Integer.parseInt(JOptionPane.showInputDialog("Enter the exponent value :"));		
		result = startAddition(b, e);
		JOptionPane.showMessageDialog(null, "Power of " + b + ", " + e + " = " + result);
	}
	
	public static int startAddition(int value, int loop){
		if(loop == 1){
			return value;
		}else{
			return value + startAddition(value, loop-1);
		}
	}
	
}