Showing posts with label super-digit. Show all posts
Showing posts with label super-digit. Show all posts

Friday, July 31, 2020

Write a program to input a number and find the Super Digit of this number.(7645, number’s largest digit+1=super digit, 7+1=8)

63)  Write a program to input a number and find the Super Digit of this number.(7645, number’s largest digit+1=super digit, 7+1=8)


import java.util.*;
public class Super_digit
{
   public static void main(String args[ ])
   {
              Scanner sc = new Scanner (System.in);
              System.out.println("Enter a number");
              int a = sc.nextInt();
              int c = 0;
              while(a>0)
              {
                  int d = a%10;
                  if(d>c)
                  {
                      c=d;
                  }
                  a=a/10;
              }
              System.out.println("Super digit = "+(c+1));
   }
}

Output :





 

 jhvghvgk ;nkjn ,nkjhj