Armstrong Number java Program Example | Armstrong number ka program kaise kare.

So in that post Armstrong Number java Program Example i will give one program with the help of this program u can find out Armstrong number. so firstly need to understand what is means by Armstong number.

Armstrong using While

package logicaltask;

public class ArmstrongWhile {
	int rem;
	int s=0;
	int no=1535;

	public void arm() {
		int n=no;

		while(no!=0) {
			rem=no%10;
			s=s+rem*rem*rem;
			no=no/10;//101/10=10,10/10=1
		}
		if(n==s)
		{
			System.out.println("Armstrong number" + s);
		}
		else
		{
			System.out.println(" no is not Armstrong");
		}
	}


	public static void main(String [] args) {
		
		ArmstrongWhile a=new ArmstrongWhile();
		a.arm();

	}
}

Armstrong using While

Armstrong Number java Program Example.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

7th day of Navratri 10-2-2022 Sanjay Raut: संजय राउत के घर रविवार सुबह पहुंची ED, President Draupadi Murmu Vedanta declares dividend of Rs 19.5 per share CBSE 10th 12th Results 2022-जारी होने वाला है