51) Write a program to input a number and check whether it is Niven Number (Harshad Number) or not? (81=8+1=9,81%9=0)
import java.util.*;public class Niven_number{public static void main(String args[ ]){Scanner sc = new Scanner (System.in);System.out.println("Enter a number");int a = sc.nextInt();int s = 0;int p = a;while(p>0){int d = p%10;s=s+d;p=p/10;}if(a%s==0){System.out.println("Entered number is a NIVEN(HARSHAD) number ");}else{System.out.println("Entered number is not a NIVEN(HARSHAD) number ");}}}