Armstrong Number | To check if a given number is an Armstrong number or not | Java

preview_player
Показать описание

Subscribe to my channel so that you do not miss any topic.

Рекомендации по теме
Комментарии
Автор

class Ambstrong {
public static void main(String[] args) {
int n =153;
int temp;
int amb = 0;
int original = n;
while(n>0){
temp = n%10;
temp = (int)Math.pow(temp, 3);
amb = amb+temp;
n = n/10;
}
if(original==amb){
System.out.println("amb");
}else{
System.out.println("not amb");
}
}
}


Thank you so munch... 👌

Btechquastions-zhcy
Автор

*Check Armstrong number for n digits*

import java.lang.*;
import java.util.Scanner;
public class armstrongNum {
public static void main(String[] args) {
// Asking for INPUT from USER
System.out.print("Enter a Number: ");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int s = n;
int m = n;
double r, q = 1;
int counter=0;
double sum=0;

// To count number of Digits entered by USER
while (n > 0) {
r = n % 10;
n = n / 10;
counter++;
}

// Logic here
while (m > 0) {
q = m % 10;
q=Math.pow(q, counter);
sum+=q;
m = m / 10;
}

// Checking
if (sum==s) {
System.out.println("Yes it is a Armstrong Number");
} else {
System.out.println("Not a Armstrong Number");
}
}
}

prakharsrivastava
Автор

kya bat hai yar mza hi aagya padh ke.lage raho bahi genius

ZakiaShabnam-pk
Автор

Splendid!! Your method of first explaining each step before writing the program is amazing. I have been struggling since months to find a good computer teacher and I never understood these concepts but after watching your video I feel blessed. I have understood. Thank you❤️!

sarahfatima
Автор

Thank you so much ❤ please continue to do like these videos❤❤❤

Reahroy-frjl
Автор

u made my life very easy thankyou so much.

kainaatmakhani
Автор

Thank you so much your videos helped me a

anusharasumolla
Автор

everyone learning the program meanwhile me getting saced in 2am by hearing a brid sound 4:28😂

Kishore-xzcb
Автор

How to find the first, last and middle number in an given input in java, post a video for this ques .The method of teaching in the notebook is easily understandable.Good teaching methodology.

keerthanaselvaraj
Автор

Superb bro. 🙏thanks alot for make coding this easy... I was unable to understand the armstorng concept but when I came across your video now I started considering myself pro at coding😝😂👍

payalnishad
Автор

Brother there we need to do explicit type conversion near applying power else we will get an lossy conversion error

sindhuhari
Автор

Sir, make vdo on
Find a armstrong number btwn
2 numbers!

Aishwarya_Shettar
Автор

Hi sir you should initialize temp as double as math pow cant be in int data type

mepreetii
Автор

anna, Armstrong number in a given range in java edhuku coding vanum anna pls video upload 😔pannunga

PreethiRenu
Автор

Sir akkada 153 number iccham kabatti math.(temp 3 ) ani pettaru but asalu ye number ivvakunda Armstrong aa kadha ani telusukovadam ela

sureshirla
Автор

If your loss conversation, just change your temp data type from integer to double...eg declare your temp like: double temp;


Your explanations are amazing, especially the way you break down the question through pseudo-code and you show every declared variable duty while executing the code...

docmusiq
Автор

Sir ...plz how to generate random number par vedio banao ..

priyankapatil
Автор

Sir, *Definition Check*
An Armstrong number is a positive n-digit number that is equal to the sum of the nth powers of their digits.
(not only by cubes, cubes for only 3 digits).
Ex: 8208 = (8^4 + 2^4 + 0^4 + 8^4) = 8208. *not by cubes* .

antonychellamarul
Автор

Write a program add two number without using additional operator in java.
How to sir

appuappu
Автор

Sir If u don't mine u r way of explanation is so nyc but u r voice is not audible properly please raise u r voice sir

durgabhavani
welcome to shbcf.ru