-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinalExam.cpp
More file actions
73 lines (69 loc) · 1.5 KB
/
Copy pathFinalExam.cpp
File metadata and controls
73 lines (69 loc) · 1.5 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "iostream"
#include <Math.h>
#include <string>
using namespace std;
int main(){
//barname E benvisid ke reshte E ra az vurudi daryaft kone va bege chand ta A chand ta B chand ta C dare va mabaghi ro ham tedadeshun ra bege
//2:
// while(1){
// char exit = 'n';
// string input;
// cin >> input;
// int As = 0, Bs = 0, Cs = 0, Others = 0;
// for(int index = 0; index < input.length(); index++){
// switch(input[index]){
// case 'A':{
// As++;
// break;
// }
// case 'a':{
// As++;
// break;
// }
// case 'B':{
// Bs++;
// break;
// }
// case 'b':{
// Bs++;
// break;
// }
// case 'C':{
// Cs++;
// break;
// }
// case 'c':{
// Cs++;
// break;
// }
// default:{
// Others++;
// break;
// }
// }
// }
// cout << "A's: " << As << endl << "B's: " << Bs << endl << "C's: " << Cs << endl << "Others: "<< Others << endl;
// cout << "Exit? (y/n) ";
// cin >> exit;
// if (exit == 'y') break;
// }
//1
//barname E benvisid ke tamame adad e aval char raghami ra chap kone.
//zoj nabashe
//baghimande taghsime un adad bar hame adade nesfe un sefr nashe
//range [1000, 9999]
for(int number = 1000; number <= 9999; number++){
bool isPure = true;
if (number % 2 == 0) continue;
for (int j = 3; j <= number / 2; j++){
if (number % j == 0){
isPure = false;
break;
}
}
if (isPure) cout << number << endl;
}
system("color C");
cout << endl;
system("pause");
}