cours0708/workspace/G5a_exercices/fr/blankoworld/g5a/Puissance.java

41 lines
560 B
Java
Raw Permalink Normal View History

2008-11-25 21:11:16 +00:00
package fr.blankoworld.g5a;
import iutsud.Console;
public class Puissance {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int x;
int y;
int resultat;
x = Integer.parseInt(args[0]);
y = Integer.parseInt(args[1]);
if(y==0)
{
resultat = 1;
}
else if (y==1)
{
resultat = x;
}
else
{
int i = 0;
resultat = x;
for(i = 1; i < y; i++)
{
resultat = resultat * y;
}
}
System.out.println(resultat);
}
}