Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64594047
premier.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 28, 00:52
Size
596 B
Mime Type
text/x-c
Expires
Thu, May 30, 00:52 (2 d)
Engine
blob
Format
Raw Data
Handle
17906657
Attached To
R10932 CS-119
premier.cc
View Options
#include <iostream>
#include <cmath>
using
namespace
std
;
int
main
()
{
cout
<<
"Entre un nombre entier !"
<<
endl
;
int
n
;
cin
>>
n
;
if
(
n
%
2
==
0
)
{
cout
<<
"L'entier est pair."
<<
endl
;
}
else
{
float
R
(
floor
(
sqrt
(
n
)));
for
(
int
i
(
3
);
i
<=
R
;
i
++
)
{
if
(
n
%
i
==
0
)
{
cout
<<
n
<<
" est divisible par "
<<
i
<<
"."
<<
endl
;
return
0
;
}
}
cout
<<
n
<<
" est premier."
<<
endl
;
}
return
0
;
}
Event Timeline
Log In to Comment