Java Program #11 - Find Armstrong Number in Java

  Рет қаралды 22,424

Programming For Beginners

Programming For Beginners

Күн бұрын

Java Program to find Armstrong Number in java
In this video by Programming for Beginners we will learn to write Java Program for Armstrong Number, using Java Tutorial videos.
This Java program is very important for your Java interview questions or if you are learning Java Programming language as a student.
An Armstrong number is a positive m-digit number that is equal to the sum of the mth powers of their digits.
Examples:
1: 1^1 = 1
2: 2^1 = 2
3: 3^1 = 3
153: 1^3 + 5^3 + 3^3 = 1 + 125+ 27 = 153
125: 1^3 + 2^3 + 5^3 = 1 + 8 + 125 = 134 (Not an Armstrong Number)
1634: 1^4 + 6^4 + 3^4 + 4^4 = 1 + 1296 + 81 + 256 = 1643
1741725 is an Armstrong Number.
==========
Java Tutorial for Beginners Playlist:
• Java Tutorial
All Java Programs Playlist:
• Java Programs
We can learn Java Programming language to make web applications or mobile applications for android phones and several other applications for windows, Mac OS and Unix operating systems. Also we can make android applications using Java programming. The concepts covered will be related to basic java and core java that will help you in your next interview questions. You can use any version of Java but all concepts will be same for all java versions. I will be using Java SE 8.
Java is a high-level programming language. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
Java is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain.
Java JDK:
www.oracle.com...
Eclipse IDE:
www.eclipse.or...
KZbin Gears:
Microphone: amzn.to/3iIk5K3
Mouse: amzn.to/35irmNF
Laptop: amzn.to/3iG0jyD
#JavaProgram #JavaTutorial #Programming #Java
============================
LIKE | SHARE | COMMENT | SUBSCRIBE
Thanks for watching :)

Пікірлер: 33
@programmingforbeginners7392
@programmingforbeginners7392 11 ай бұрын
All JAVA Programs Playlist: kzbin.info/aero/PLhyraTKIsw59nQJKvZTKmNK2aMxHwvLOa Java Tutorial Playlist: kzbin.info/aero/PLhyraTKIsw5_WemVMvshNm-0aC7zfISCO
@shashank125sanji
@shashank125sanji Ай бұрын
bro really thank for teaching it properly it was asked in aptitude test but i was blank in the test i will start learning properly with ur vedios
@programmingforbeginners7392
@programmingforbeginners7392 Ай бұрын
Welcome bro. All the best ☺️
@abhijit6350
@abhijit6350 27 күн бұрын
bhai you earned a subscriber, hats off bro, may god bless you
@programmingforbeginners7392
@programmingforbeginners7392 26 күн бұрын
Thank you.. keep watching
@diptimayeepatro6097
@diptimayeepatro6097 Жыл бұрын
I think this one is the best way to solve and nice explanation....it would be help to crack the interview... thank you so much sir for understanding nicely 👌🥰🙏
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Welcome. Glad it was helpful. Subscribe and Share with your friends 😀
@pavankumar7864
@pavankumar7864 5 ай бұрын
public static void main(String[] args) { int n=407; int orginal_number=n; int sum=0; int numOfdigits=String.valueOf(n).length(); while(n>0){ int digit= n%10; n=n/10; sum= (int) (sum+Math.pow(digit,numOfdigits)); } if (sum==orginal_number){ System.out.println(orginal_number+" is the Armstrongnumber"); }else { System.out.println(orginal_number+" is not a Armstrongnumber"); } }
@programmingforbeginners7392
@programmingforbeginners7392 5 ай бұрын
good. keep practicing
@shiwangikar5422
@shiwangikar5422 Ай бұрын
Complicated😅
@Giriagroandfashion
@Giriagroandfashion Жыл бұрын
Good but Very Confusing
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Please practice example programs to be more clear
@nagamanim3390
@nagamanim3390 Жыл бұрын
Can you please tell what is the time complexity and space complexity for this solution
@thenameis-jatin
@thenameis-jatin Жыл бұрын
thank you bro for clearing my doubts ❤
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Welcome. Subscribe and share with your friends 😄
@HimaBindu-ki5js
@HimaBindu-ki5js 4 ай бұрын
Nice explanation
@programmingforbeginners7392
@programmingforbeginners7392 4 ай бұрын
Thanks 👍
@anandbalmiki8346
@anandbalmiki8346 Жыл бұрын
Nice explanation and very clear code
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Thank you so much 👍
@abdulrahim7763
@abdulrahim7763 8 ай бұрын
tried without while loop..this is working fine for me (give any number within the limit of integer data type) Scanner sc=new Scanner(System.in); System.out.println("Enter any number to find out if it is a Armstrong number or not"); int input=sc.nextInt(); String s=""; String count=s.valueOf(input); int input_size = count.length(); int digit; double Armstrong=0; double result=0; int actual=input; if(input>0) { for(int i=1;i
@crazzyraghu8726
@crazzyraghu8726 Жыл бұрын
Bro, I m getting error that " Sum cannot resolved to be variable'
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Define sum variable after: int digits, temp, sum = 0; This should solve your issue
@crazzyraghu8726
@crazzyraghu8726 Жыл бұрын
@@programmingforbeginners7392 Now i got it bro, Thanks for the Response.
@crazzyraghu8726
@crazzyraghu8726 Жыл бұрын
@@programmingforbeginners7392 int number; Scanner sc = new Scanner(System.in); System.out.println("Enter Number : "); number = sc.nextInt(); System.out.println("Is amstrong num : " + isAmstrong(number)); } static boolean isAmstrong(int n) { int digits = 0, temp; temp = n; while(temp > 0) { temp = temp/10; digits++; } System.out.println("No of digits: " + digits); temp = n; int sum = 0; while(temp> 0) { int lastDigit = temp %10; sum = (int)(sum +Math.pow(lastDigit, digits)); temp =temp/10; } System.out.println("sum is : " + sum); if(sum == n) return true; return false; } }
@Faith-b9w
@Faith-b9w 28 күн бұрын
Can we compile this program in cmd?
@abhijit6350
@abhijit6350 27 күн бұрын
ig only for eclipse , vs code, etc. not for cmd prompt
@Faith-b9w
@Faith-b9w 27 күн бұрын
@@abhijit6350 ok ...thank u
@programmingforbeginners7392
@programmingforbeginners7392 26 күн бұрын
Java programs can be executed from cmd
@crazzyraghu8726
@crazzyraghu8726 Жыл бұрын
public static void main(String[] args) { int number; Scanner sc = new Scanner(System.in); System.out.println("Enter Number : "); number = sc.nextInt(); System.out.println("Is amstrong num ; " + isAmstrong(number)); } static boolean isAmstrong(int n) { int digits, temp; temp = n; while(temp > 0) { temp = temp/10; digits++; } System.out.println("No of digits: " + digits); temp = n; while(temp> 0) { int lastDigit = temp %10; sum = (int)(sum +Math.pow(lastDigit, digits)); temp =temp/10; } System.out.println("sum is ; " + sum); if(sum == n) return true; return false; } } Receiving error that sum cannot resolved to a Variable
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Define sum variable after: int digits, temp, sum = 0; This should solve your issue
@reddybasha3255
@reddybasha3255 Жыл бұрын
Nice video bro Please simplify the code
@programmingforbeginners7392
@programmingforbeginners7392 Жыл бұрын
Thank you
@nagamanim3390
@nagamanim3390 Жыл бұрын
Can you tell me what is time complexity and space complexity for this solution?
Java Program #12 - Reverse a Number in Java
6:28
Programming For Beginners
Рет қаралды 3,8 М.
5.16 Armstrong Number in Java
6:01
Telusko
Рет қаралды 315 М.
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 25 МЛН
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 42 МЛН
Meta Has Changed The Game.
10:17
DiscoVR Tetiana
Рет қаралды 6 М.
Radxa X4: An N100 Pi
20:48
ExplainingComputers
Рет қаралды 60 М.
Armstrong Number | To check if a given number is an Armstrong number or not | Java
10:21
Armstrong Number in Java - In Hindi
22:38
codeitup
Рет қаралды 45 М.
Program To Check for Armstrong Number in Java by Deepak
16:11
Smart Programming
Рет қаралды 327 М.
How to solve any Star Pattern Program
18:47
Simply Coding
Рет қаралды 1,1 МЛН