Advertisement
Guest User

Untitled

a guest
Oct 20th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. public class Main {
  2.  
  3. public static boolean containsEight(String str){
  4.     if (str.contains("8")){
  5.         return true;
  6.  
  7.     }
  8.     return false;
  9. }
  10.  
  11.     public static void main(String[] args) {
  12.     // write your code here
  13.  
  14.         Scanner scan = new Scanner(System.in);
  15.  
  16.         System.out.println("Unesite n");
  17.         int n=scan.nextInt();
  18.  
  19.         for (int i=0;i<=n;i++){
  20.             String pom = i+"";
  21.             if (containsEight(pom)){
  22.                 System.out.println(i);
  23.  
  24.             }
  25.         }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement