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

To create an html page with frames and frameset

1. Write a program to insert a new element at end as well as at a given position in an array in Java

1. To familiarize with network devices like switch, hub, routers and bridges in LaTex