Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cmath>
- #include <vector>
- using namespace std;
- void erathos(int array[] , int len) {
- int j;
- for (int i = 2 ; i < len ; i++){
- if (array[i]!=5){
- array[i] = 1 ;
- j = 2 * i;
- while( j < len)
- {
- array[j] = 5;
- j *= i;
- }
- }
- }
- for (int i = 0 ; i < len ; i++) {
- cout << array[i] << " " ;
- }
- cout << endl ;
- }
- int main(){
- cout << "hello\n" ;
- int a = 0 ;
- int arr[20];
- for (int i = 0 ; i < 20 ; i++) {
- arr[i] = 0 ;
- }
- erathos(arr , 20 ) ;
- cin >> a ;
- cout << "asd";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment