Skip to content

Commit 03d91f0

Browse files
committed
added more codes
1 parent 5896a4f commit 03d91f0

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

Diff for: coding_challenge/a.out

-704 Bytes
Binary file not shown.

Diff for: coding_challenge/armstrong.c

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//armstrong no
2+
#include<stdio.h>
3+
#include<math.h>
4+
void checkArmstrong(int n)
5+
{
6+
int temp = n,temp1=n,length =0,r,d=1,sum=0;
7+
while(temp>0)
8+
{
9+
length++;
10+
temp/=10;
11+
}
12+
while(temp1>0)
13+
{
14+
r = temp1%10;
15+
int l=0,d=1;
16+
while(l<length)
17+
{
18+
d *= r;
19+
l++;
20+
}
21+
sum += d;
22+
printf("%d\n",sum);
23+
temp1/=10;
24+
}
25+
printf("%d\n",sum);
26+
if(sum == n)
27+
printf("armstrong no\n");
28+
else
29+
printf("not armstrong no\n");
30+
}
31+
int main()
32+
{
33+
int n;
34+
printf("enter n");
35+
scanf("%d",&n);
36+
checkArmstrong(n);
37+
}

Diff for: coding_challenge/armstrong.exe

40.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)