Thank you :) Note: Join our telegram group here - t.me/qafoxoriginal
@karthikeyanravi9840 Жыл бұрын
Sir, thank you so much this is exactly I was looking for. Loved your content! 😍
@QAFox Жыл бұрын
Most welcome!
@Rakesh-le6mi11 ай бұрын
Thank you sir
@TejendraPatel-wz2yk10 ай бұрын
If i Enter number with 6 digit?
@DeveshKumarprajapati-we4oi Жыл бұрын
This program is not perfect because it will check only that number which is in between 100 to 999. To make this program perfect we have to count the digit and find the power of each digit with the help of count digit value. let's assume the number is 1234 then we have to calculate it like 1^4 + 2^4 + 3^4 + 4^4
@QAFox11 ай бұрын
You can paste your better code here. Note: Join our telegram group here - t.me/qafoxoriginal
@DeveshKumarprajapati-we4oi11 ай бұрын
@@QAFox Armstrong numbers between 1 and 10000 are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474 package Checker; import java.util.Scanner; public class Checker { public static void main(String[] args) { Scanner sc=new Scanner(System.in); //Taking user input...... System.out.println("Enter the number: "); int n=sc.nextInt(); sc.close(); //calling the method for checking armstrong number int sum=armStrong(n); //checking the condition if(sum==n) { //final output System.out.println(n+ " is ARMSTRONG number."); } else { //final output System.out.println(n+ " is not ARMSTRONG number."); } } //this method is going to count the number of digit in the given number public static int countDigit(int num) { int count=0; while(num>0) { num=num/10; count++; } //returning the number of digits return count; } public static int armStrong(int num) { int sum=0; //calling the method for counting the number of digit in given number and storing it.. int pow=countDigit(num); while(num>0) { int power=1; int rem=num%10; //loop for finding power for(int i=1;i