-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (25 loc) · 759 Bytes
/
main.cpp
File metadata and controls
26 lines (25 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
using namespace std;
const int minimo = 0, maximo = 10;
int main(int argc, char **argv){
int n;
cout << "Introduzca un número entre " << minimo << " y " << maximo << ": ";
cin >> n;
if ((n < minimo) || (n > maximo))
cout << "El valor " << n << " está fuera del rango." << endl;
else
switch(n){
case 0:
cout << "No existe difinición de primo en este caso" << endl;
break;
case 2:
case 5:
case 7:
cout << "El número " << n << " es primo" << endl;
break;
default:
cout << "El número " << n << " no es primo" << endl;
break;
};
return 0;
}