public class MainActivity extends AppCompatActivity { TextView textView ; @Override protected void onCreate ( Bundle savedInstanceState ) { super .onCreate( savedInstanceState ) ; setContentView( R . layout . activity_main ) ; textView = findViewById( R . id . textView ) ; // do while loop int i = 1 ; do { textView .append( " \n " + i + " Bangladeh" ) ; i ++ ; } while ( i <= 10 ) ; // while lopp int x = 1 ; while ( x <= 6 ){ textView .append( " \n " + x + " Developer" ) ; x ++ ; } } }
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
Post a Comment