Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Updated armStrongNumber.c #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions armStrongNumber.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
#include<stdio.h>
/*The number which each number is cube is equal to orignial number then it's called armstrong number.*/
int main()
#include <stdio.h>
/*The number which each digit's cube is equal to orignial number then it's called armstrong number.*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Spelling Mistake "orignial"

void isArmstrong(int n) //Function for finding Armstrong
{
int n,a,sum,rem;
printf("Enter the number to check where number is armstrong or not:");
scanf("%d",&n);
a=n;
sum=0;
while(n>0)
int a, sum, rem;
a = n;
sum = 0;
while (n > 0)
{
rem=n%10;
sum=sum+rem*rem*rem;
n=n/10;
rem = n % 10;
sum = sum + rem * rem * rem;
n = n / 10;
}
if(sum==a)
printf("%d is armstrong number",a);
if (sum == a)
printf("%d is armstrong number", a);
else
printf("%d is not armstrong number",a);
printf("%d is not armstrong number", a);
}
int main()
{
int n;
printf("Enter the number to check where number is armstrong or not:");
scanf("%d", &n);
isArmstrong(n);//calling function

return 0;
}