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
/
ex2.c
blob
fb9ee8882050128df5eabebd3b4152178a19a74f
1
/*factorial of a given number*/
2
3
4
#include<stdio.h>
5
6
int
main
()
7
{
8
int
num
;
9
int
i
;
10
long
fact
;
11
printf
(
"Enter a number:"
);
12
scanf
(
"%d"
,&
num
);
13
14
i
=
1
;
15
fact
=
1
;
16
while
(
i
<=
num
)
17
{
18
fact
=
fact
*
i
;
19
i
++;
20
}
21
printf
(
"The factorial is %ld
\n
"
,
fact
);
22
printf
(
"Bye
\n
"
);
23
return
0
;
24
}