diff --git a/Hello.c b/Hello.c index b85ccb7f5e48fca699577e5388017cc72664c440..1110c0d3937ad6b7051a23ce93c4a288d85d4b7f 100644 --- a/Hello.c +++ b/Hello.c @@ -3,37 +3,23 @@ NAME: Hello - DESCRIPTION: + Description: this is about the simplest program thinkable to demonstrate parallel execution with OpenMP VERSION(S): 1. original version j. behrens 6/2021 - COPYRIGHT INFORMATION: - Copyright (C) 2021 Jörn Behrens <joern.behrens@uni-hamburg.de> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - *****************************************************************/ #include <stdio.h> #include <omp.h> + int main(int argc, char** argv) { + /* local declarations */ int thrd_id; @@ -43,6 +29,21 @@ int main(int argc, char** argv) { thrd_id = omp_get_thread_num(); printf("Hello from process Number %d\n", thrd_id); + int i,j; + int count=100000; + for(i=thrd_id*count+2;i<count*(thrd_id+1)+2;i++){ + + for (j = 2; j<=i; j++) + { + if(i%j==0) + { + break; + } + } + if(i==j){ + printf("%d is a prime \n,",i); + } + } } return 0;