using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace reversestring
{
class programme
{
static void Main(string[] args)
{
int num,r ,save, newnum =0,count=0;
console.writeline("enter a name");
num = console.readline();
save =num;
while(num <= 1000)
{
while(num!=0)
{
num = num/10;
count++;
}
num = save;
whaile(num!=0)
{
r=num%10;
newnum = newnum+p0w(r,count);
num =num/10;
}
if(newnum ==save)
console.writeline("number is nor armstrong{0}", save);
else
console.writeline("number is nor armstrong");
}
}
}

Sudhir DehadePosted Jul 26, 2018, 11:26 AM
You have made lots of mistakes in the above program, at least run the program before you upload it. int num, r, save, newnum = 0, count = 0; Console.WriteLine("enter a name"); num =Convert.ToInt32(Console.ReadLine()); save = num; while (num <= 1000) { while (num != 0) { num = num / 10; count++; } num = save; while(num != 0) { r = num % 10; newnum = Convert.ToInt32( newnum + Math.Pow(r, count)); num = num / 10; } if (newnum == save) Console.WriteLine("number is nor armstrong{0}", save); else Console.WriteLine("number is nor armstrong"); } }
Sudhir DehadePosted Jul 26, 2018, 11:20 AM
Title of program is list out the Armstrong number between 1 to 1000, and you are giving program for checking if the number is Armstrong or not... That is a big mistake .....
Munesh SharmaPosted Apr 8, 2014, 4:56 AM
This is my mistake , here console.writeline("enter a name"); we have to write console.writeline("enter a number"); sorry for this.