using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int m;
int r;
int temp = 0;
Console.WriteLine("Please Enter Any Number:");
String no = Console.ReadLine();
m=int.Parse(no);
int n = m;
while (m > 0)
{
r = m % 10;
m = m / 10;
temp = temp + (r * r * r);
}
if (n == temp)
Console.WriteLine("The Entered number is armstrong");
else
Console.WriteLine("The entered number is not armstrong");
Console.ReadLine();
}
}
}
<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please Enter Any Number:153
The Entered number is armstrong
Please Enter Any Number:112
The entered number is not armstrong
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int m;
int r;
int temp = 0;
Console.WriteLine("Please Enter Any Number:");
String no = Console.ReadLine();
m=int.Parse(no);
int n = m;
while (m > 0)
{
r = m % 10;
m = m / 10;
temp = temp + (r * r * r);
}
if (n == temp)
Console.WriteLine("The Entered number is armstrong");
else
Console.WriteLine("The entered number is not armstrong");
Console.ReadLine();
}
}
}
<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please Enter Any Number:153
The Entered number is armstrong
Please Enter Any Number:112
The entered number is not armstrong
No comments:
Post a Comment