Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Tar22Page46
- {
- public static void getTime(int num,int digit)
- {
- int temp;
- int count = 1 ;
- boolean check = false;
- while(num != 0)
- {
- temp = num % 10;
- if(temp==digit)
- {
- System.out.print(count + " ");
- check=true;
- }
- num= num / 10;
- count++;
- }
- if(!check)
- System.out.print("None");
- }
- public static Scanner in = new Scanner(System.in);
- public static void main(String []args)
- {
- System.out.println("Enter a num ");
- int num = in.nextInt();
- for(int i=0;i<=9;i++)
- {
- System.out.print(i + " is: ");
- getTime(num,i);
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement