Java program to find whether the given number is an Armstrong number

  Рет қаралды 7,393

QAFox

QAFox

Күн бұрын

View Notes Here - www.evernote.co...

Пікірлер: 9
@pl_0077
@pl_0077 Жыл бұрын
Great series ever for java program
@QAFox
@QAFox 11 ай бұрын
Thank you :) Note: Join our telegram group here - t.me/qafoxoriginal
@karthikeyanravi9840
@karthikeyanravi9840 Жыл бұрын
Sir, thank you so much this is exactly I was looking for. Loved your content! 😍
@QAFox
@QAFox Жыл бұрын
Most welcome!
@Rakesh-le6mi
@Rakesh-le6mi 11 ай бұрын
Thank you sir
@TejendraPatel-wz2yk
@TejendraPatel-wz2yk 10 ай бұрын
If i Enter number with 6 digit?
@DeveshKumarprajapati-we4oi
@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
@QAFox
@QAFox 11 ай бұрын
You can paste your better code here. Note: Join our telegram group here - t.me/qafoxoriginal
@DeveshKumarprajapati-we4oi
@DeveshKumarprajapati-we4oi 11 ай бұрын
@@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
Java program to find the factorial of the given number
8:49
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Armstrong Number | To check if a given number is an Armstrong number or not | Java
10:21
Java Program #11 - Find Armstrong Number in Java
11:09
Programming For Beginners
Рет қаралды 30 М.
Frequently Asked Java Program 10: Generate Fibonacci series
9:50
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 918 М.
5.16 Armstrong Number in Java
6:01
Telusko
Рет қаралды 325 М.
Java Program #10 - Palindrome Number in Java
10:03
Programming For Beginners
Рет қаралды 22 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН