using System;
class Class1
{
static void Main(string[] args)
{
int a, n, i, m = 0;
Console.WriteLine("Enter any number");
a = int.Parse(Console.ReadLine());
n = a;
for (i = 0; n > 0; i++)
{
int x = n % 10;
m = x * x * x;
n = n / 10;
}
if (a == m)
Console.WriteLine("the given number is an armstrong number");
else
Console.WriteLine("the given number is not armstrong number");
Console.ReadLine();
}
}
class Class1
{
static void Main(string[] args)
{
int a, n, i, m = 0;
Console.WriteLine("Enter any number");
a = int.Parse(Console.ReadLine());
n = a;
for (i = 0; n > 0; i++)
{
int x = n % 10;
m = x * x * x;
n = n / 10;
}
if (a == m)
Console.WriteLine("the given number is an armstrong number");
else
Console.WriteLine("the given number is not armstrong number");
Console.ReadLine();
}
}
OUTPUT
CLICK TO DOWNLOAD
No comments:
Post a Comment