repo.or.cz
/
letusc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
move to repo.or.cz
[letusc.git]
/
ch3
/
exercises
/
ex5.c
blob
5f0df230e9f86a879edc0c5ff3996faeacb93c7d
1
/*printf ascii numbers from 1 to 500*/
2
3
#include<stdio.h>
4
#include<math.h>
5
int
main
()
6
{
7
int
i
=
1
;
8
9
int
temp
;
10
int
digit
;
11
int
sum
;
12
13
while
(
i
<=
500
)
14
{
15
temp
=
i
;
16
sum
=
0
;
17
18
while
(
temp
!=
0
)
19
{
20
21
digit
=
temp
%
10
;
22
sum
=
sum
+
pow
(
digit
,
3
);
23
temp
=
temp
/
10
;
24
}
25
26
if
(
sum
==
i
)
27
printf
(
"%d is an armstrong number
\n
"
,
i
);
28
29
/*printf("The sum is %d\n",sum);*/
30
31
i
++;
32
}
33
34
return
0
;
35
}