Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
- String n1,x1;
- int n,x,anz2=0,anz3=0,anz5=0,anzSonst=0;
- n1=tfN.getText();
- x1=tfX.getText();
- n=Integer.parseInt(n1);
- x=Integer.parseInt(x1);
- for(int i=1; i<=n; i++)
- {
- switch(n%x)
- {
- case 2: anz2++;
- break;
- case 3: anz3++;
- break;
- case 5: anz5++;
- break;
- default: anzSonst++;
- }
- }
- lbDurch2.setText(""+anz2);
- lbDurch3.setText(""+anz3);
- lbDurch5.setText(""+anz5);
- lbDurchsonst.setText(""+anzSonst);
- }
Add Comment
Please, Sign In to add comment