Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
kjc015
CSCI206-S21-62
Commits
cfec60cd
Commit
cfec60cd
authored
Mar 22, 2021
by
kjc015
Browse files
prelab complete
parent
14f2a283
Changes
2
Hide whitespace changes
Inline
Side-by-side
Labs/Lab07/exit.s
0 → 100644
View file @
cfec60cd
#
exit
.
s
.
text
.
global
_start
_start
:
li
a0
,
42
li
a7
,
93
ecall
Labs/Lab07/primes.c
0 → 100644
View file @
cfec60cd
/*
real:19.823s
user:19.508s
sys:0.308s
*/
#include
<stdio.h>
#include
<stdlib.h>
int
is_prime
(
int
n
)
{
int
i
;
for
(
i
=
2
;
i
<
(
n
-
1
);
i
++
){
if
((
n
%
i
)
==
0
){
return
0
;
}
}
return
1
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
,
n
=
0
,
maxnum
=
80
;
if
(
argc
>
1
){
maxnum
=
atoi
(
argv
[
1
]);
}
for
(
i
=
2
;
n
<
maxnum
;
i
++
){
if
(
is_prime
(
i
)){
printf
(
"%7d"
,
i
);
n
++
;
if
((
n
%
10
)
==
0
){
printf
(
"
\n
"
);
}
}
}
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment