sohil.shivani 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.
pls. help me guys.
No, you read the rules first, then make an effort.
pls. help me guys.
using System;
using System.Collections.Generic;
using System.Text;
namespace recursive_amstrong
{
class Program
{
static void Main(string[] args)
{
string str;
Console.WriteLine(" Enter the number ");
str = Console.ReadLine();
int convert = int.Parse(str);
int armstrong_no = armstrong(convert);
Console.WriteLine(armstrong_no);
Console.ReadLine();
}
static int armstrong(int value)
{
int factor, remainder,total = 0;
while (value > 0)
{
factor = value / 10;
remainder = value % 10;
total = total + remainder * remainder * remainder;
value = factor;
//return value;
}
return 1;
}
}
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.