Search This Blog

Sunday, March 22, 2020

Armstrong number [ C- Programming]

                                     C-Programming:-

In this tutorials, you will learn

 

1) Write a progrm to check whether a number is armstrong or not.

#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0,temp,c;
printf("enter any no");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
c=r*r*r;
sum=sum+c;
n=n/10;
}
if(n=sum)
{
printf("number is armstrong ");
}
else
{
printf("number is not armstrong");
}
getch();
}

Mr. abhijeet dwivedi

Developer

Hey, I'm Abhijeet

0 comments:

Post a Comment

If you have any doubt, please let me know