Computer Science, asked by Nasra1, 1 year ago

i want to know what is wrong in this program...why is error showing..?

Attachments:

Answers

Answered by abhishrutimandp4au82
1
I think there's some problem in the class name. otherwise the program is correct
Answered by UnknownDude
1
U haven't given the data type for sum.
Here is the program for armstrong numbers
class armstrong
{
public static void main(int a)
{
int n=a,sum=0;
while(n>0)
{
int rem=n%10;
int p=(int)(Math.pow(rem,3));
sum+=p;
}
if(a==sum)
System.out.println("Armstrong");
else
System.out.println("Not Armstrong");
}
}
Similar questions