Help help help help help pls.
write a program that takes a number and checks if the given number is a 3 digit number or not.(java ) (use if to determine)
Answers
Answered by
0
Answer:
Explanation:
First, given number (number)'s value is stored in another integer variable, originalNumber. This is because, we need to compare the values of final number and original number at the end.
Then, a while loop is used to loop through originalNumber until it is equal to 0.
On each iteration, the last digit of num is stored in remainder.
Then, remainder is powered by 3 (number of digits) using Math.pow() function and added to result.
Then, the last digit is removed from originalNumber after division by 10.
Finally, result and number are compared. If equal, it is an armstrong number. If not, it isn't.
vermaameesha:
i want a program
Answered by
2
import java.util.*;
class digit
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.print("enter no.");
int a=sc.nextInt();
if (a>99)
System.out.print("three digit");
else
System.out.print("not 3digit");
}
}
Similar questions
History,
6 months ago
Computer Science,
6 months ago
English,
6 months ago
Political Science,
1 year ago
Physics,
1 year ago