knugi

Untitled

Jun 30th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. package replace;
  2.  
  3. public class Liczby1120 {
  4. public static void main(String[] args){
  5. String liczby = "";
  6. for(int i=1;i<=120;i++){
  7. liczby = liczby+i;
  8. }
  9. System.out.println(liczby);
  10. int jeden = 0;
  11. for(int i=0;i<=120;i++){
  12. String a = liczby.charAt(i)+"";
  13. if(a.equals("1")){
  14. jeden++;
  15. }
  16. }
  17. System.out.println(jeden);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment