Tuesday, 25 August 2020

HOW TO FIND ARMSTRONG NUMBER OR NOT IN C PROGRAM?

IN THIS PAGE WE ARE GOING TO LEARN ABOUT THE NUMBER IS ARMSTRONG NUMBER OR NOT. THE FOLLOWING PROGRAM EXPLAINS ABOUT ARMSTRONG NUMBER OR NOT:

#include<stdio.h>
#include<conio.h>
void main()
{
int n,n1,r,s=0;
clrscr();
printf("Enter the number:\n");
scanf("%d",&n);
n1=n;
while(n!=0)
{
r=n%10;
s=s+r*r*r;
n=n/10;
}
if(n1==s)
{
printf("Armstrong number\n");
}
else
{
printf("Not Armstrong number\n");
}
getch();
}



THE ABOVE IMAGE IS THE OUTPUT OF ARMSTRONG PROGRAM.

No comments:

Post a Comment

C Programming

What is DBMS in brief?

A Database Management System (DBMS) is a software suite designed to efficiently manage, organize, store, manipulate, and retrieve data. It a...