Ans:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Logicals
{
class Armstrongnumber
{
static void main(string[] args)
{
Console.WriteLine("Enter Number Only..");
int num = int.Parse(Console.ReadLine());
int reminder,armstrong=0;
int store = num;
while (num > 0)
{
reminder = num % 10;
armstrong = armstrong + reminder * reminder * reminder;
num = num / 10;
}
if (armstrong == store)
{
Console.WriteLine("It's an Armstrong No..");
}
else
{
Console.WriteLine("It's Not an Armstrong No..");
}
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Logicals
{
class Armstrongnumber
{
static void main(string[] args)
{
Console.WriteLine("Enter Number Only..");
int num = int.Parse(Console.ReadLine());
int reminder,armstrong=0;
int store = num;
while (num > 0)
{
reminder = num % 10;
armstrong = armstrong + reminder * reminder * reminder;
num = num / 10;
}
if (armstrong == store)
{
Console.WriteLine("It's an Armstrong No..");
}
else
{
Console.WriteLine("It's Not an Armstrong No..");
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment