Factorical Number 5 teke chotto example 4 3 2 1

chackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

String ed = edittext.getText().toString();
int num = Integer.parseInt(ed);
int fact = 1;

for (int i = num; i>=1; i--){
fact = fact * i;
}

display.append("Factorial of "+num+" = "+fact);

}
});

 


Comments

Popular posts from this blog

Introduction to Array

Brek statement and continue statement