Skip to content

Commit 1c86990

Browse files
Merge pull request DHEERAJHARODE#2709 from ROHIT8759/main
Add a armstrong.c file
2 parents ba1cb14 + 0f8890f commit 1c86990

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

AREA_OF_A_CIRCLE.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# include<stdio.h>
2+
//AREA OF A CIRCLE
3+
int main() {
4+
float r;
5+
printf("REDIUS:-");
6+
scanf("%f", &r);
7+
printf("AREA - %f", 3.14 * r * r );
8+
return 0;
9+
}

Armstrong.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include<stdio.h>
2+
#include<math.h>
3+
int main() {
4+
int n,d=0,r,s=0,t;
5+
printf("Enter a no- ");
6+
scanf("%d",&n);
7+
t=n;
8+
while (n>0)
9+
{
10+
n=n/10;
11+
d=d+1;
12+
} n=t;
13+
while (n>0)
14+
{
15+
r=n%10;
16+
printf("%d", d);
17+
s=s+pow(r,d);
18+
n=n/10;
19+
} n=t;
20+
if (n==s)
21+
{
22+
printf("in %d is Armstrong",n);
23+
} else
24+
printf("in %d is not Armstrong",n);
25+
}

0 commit comments

Comments
 (0)