Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication6;
- import java.util.Scanner;
- public class JavaApplication6 {
- public static boolean CheckFor(int n)
- {
- while(n>0)
- {
- if(n%10==8)
- {
- return true;
- }
- n/=10;
- }
- return false;
- }
- public static void main(String[] args) {
- int n,sum=0;
- Scanner sc= new Scanner(System.in);
- n= sc.nextInt();
- if(n!=-1)
- {
- while(n>-1)
- {
- if(CheckFor(n)==true)
- {
- sum+=n;
- }
- n=sc.nextInt();
- }
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement