Program To Check Whether a Number is a Armstrong or not.

#include<iostream>
using namespace std;
int main()
{
int n,n1,rem,num=0;
cout<<"Enter a positive number:";
cin>>n;
n1=n;
while (n1!=0){
rem=n1%10;
num+=rem*rem*rem;
n1=n1/10;
}
if(num==n)
cout<<"The number is armstrong\n\n";
else
cout<<"The number is not a armstrong\n\n";
cout<<"/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/";
}

Output:

Comments

Popular posts from this blog

Program to illustrate the concept of templates.

To create an html file to implement the concept of margin, padding using cascading style sheets.

To configure the IP address for a computer connected to LAN