Computer Science, asked by roshankumar59592, 8 months ago

Ashish Kunal randomly enters a number in his computer. Write
program to check whether the number entered by him, is a one dig
number, a two digit number or a three digit number. Now, perform
these tasks:
• If it is a one digit number then display its square.
• If it is a two digit number then display its square root.
• If it is a three digit number then display its cube root.
Otherwise, display the message "The number entered is more than
three digits"​

Answers

Answered by akash112000singh
18

Answer:

void main(int n)

{

int n1=n;

s=0;

while( n>0)

{

int d=n%10;

s++;

n/=10;

}

if(s==1)

{

System.out.println("square="+(n1*n1));

}

else if(s==2)

{

System.out.println("square root="+(Math.sqrt(n1)));

}

else if( s==3)

{

System.out.println("cube root="+(Math.cbrt(n1)));

}

else

System.out.println("the number entered is more than three digits");

}

Answered by thewatchingtime123
1

Answer:

heya!! this is your answer

Attachments:
Similar questions