×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Java Examples : Frequency of the character in a paragraph Custom Exception Handling in Java
Numbers Program In Java Part 2 - Java
3303    Arnab De    12/09/2017

Some mathematical numbers are identified by different names. These names are given by different mathematicians. We can establish those numbers, logically by the Java program. For that we first know the mathematical definition of the numbers after then we must think how we can represent programmatically.

Write a program that displays all integers between the low and high that are the sum of cube of their digits. In other words, find all numbers XYZ such that XYZ=X3+Y3+Z3. try 100 for low and 1000 for high. [WBUT MCA 2014]

softetechnologies

import java.util.*;

public class Amstrong100to1000
{
public static void main(String []args)
{
int n,s=0,r;
int sn=100;
int temp;
while(sn<=1000)
{
n=sn;
s=0;
while(n>0)
{

softetechnologies

r=n%10;
s+=Math.pow(r,3);
n /=10;
}
if(s==sn)
{
System.out.println(sn + "");
}
sn++;
}
}
}

Java Examples : Frequency of the character in a paragraph Custom Exception Handling in Java
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Swami Vivekananda
If the poor cannot come to education, education must reach them, at the plough, in the bakery factor
Swami Vivekananda
2157
64.28
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     47381
25/06/2018     39476
01/01/2018     39090
28/06/2017     36981
02/08/2017     35706
01/08/2017     29942
06/07/2017     29727
15/05/2017     29213
14/07/2017     25096
11/09/2018     24241
softetechnologies