program for armstrong series
Write a program for armstrong series? I have tried in c++ but i want in C#.
#include "iostream"
#include "math.h"
using namespace std;
int main()
{
/*armstrong number -> if sum of cubes of indiviual digits is equal to the number itself
eq- if number is 371 => 3*3*3 + 7*7*7 + 1*1*1 = 371 (armstrong number)
*/
int num,cube=0,temp=0;
double remainder=0;
cout<<"enter the number";
cin>>num;
temp=num;
while(temp !=0)
{
remainder = temp % 10;
cout<<"remainder"<<remainder<<endl;
cube+=pow(remainder,3);
cout<<"cube"<<cube<<endl;
temp=temp/10;
cout<<"temp"<<temp<<endl;
}
if(cube==num)
{
cout<<"Number is armstrong";
}
else
cout<<"not";
return 0;
}