Computer Science, asked by aryanarora272006, 1 month ago

Write a program to find square of the number and the sum of its digits if the square is divisble by the sum show the message india other wise show message not divisible​

Answers

Answered by himanshu2006vps
0

Explanation:

import java.util.Scanner;

public class Prog

{

public static void main(String args[])

{

Scanner in = new Scanner (System.in);

int a,square,m, n, sum = 0;

System.out.print("Enter the number m:");

m = in.nextInt();

System.out.println("Enter the value of a");

a= in.nextInt();

square= a*a;

{

while(m > 0)

{

n = m % 10;

sum = sum + n;

m = m / 10;

}

}

int g= square/sum;

if( g==0)

System.out.println("india");

else

System.out.println("not divisible");

}

}

Similar questions