Advertisement
Guest User

Untitled

a guest
Jan 19th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class exponentmethod {
  3. public static void main (String args []){
  4.  
  5. Scanner input = new Scanner (System.in);
  6.  
  7. int total = 0 , first = 0 , second = 0 ;
  8.  
  9.  
  10. System.out.print("Enter base");
  11. first= input.nextInt();
  12.  
  13. System.out.print("Enter exponent");
  14. second= input.nextInt();
  15.  
  16. total= a(first, second);
  17.  
  18.  
  19. System.out.print("result"+total);
  20. }
  21.  
  22.  
  23. static int result=1;
  24. static int a(int t,int y){
  25. return result;
  26. int ctr=1;
  27. while (ctr!=y){
  28. result = result * t;
  29. ++ctr;
  30. }
  31.  
  32.  
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement