+ 1
Display the count of Armstrong number using arrays
can anybody help me solve this
7 Respostas
+ 1
Hi Keerthana
I published rigth now two programs:
- Armstonmg Numbers Until 100K
- Armstonmg Numbers
Try to adapt your array or explain how do you need and ask for help.
I hope it helps.
Ricardo
+ 1
Hi Keerthana, sorry, what means "ans pls ans" abbreviation?
+ 1
I want the answer of this question in this section itself
+ 1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//Test with 153, 371, 1634, 54748
namespace SoloLearn {
class Program {
static void Main(string[] args){
Console.WriteLine("An Armstrong number is an n-digit number that is equal to the sum of the nth powers of its digits.\n");
int num=153,rem=0,temp,numL;
double sum=0;
while (num<=100000){
numL = Convert.ToString(num).Length;
temp = num;
while (temp != 0) {
rem = temp % 10;
sum += Math.Pow(rem,numL);
temp /= 10;
}
if (num == sum) { Console.WriteLine("{0} is a Armstrong Number", num);
}
++num;
sum = 0;
}
}
}
}
+ 1
Ok Keerthana. The programs are published in the "code playground" area, I will be glad if you get a like there!
0
I M not getting the ans pls ans me
0
Thank u very much bro