Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
18BCE2182 ASSESS_2 Q3
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//gcc 7.4.0 #include <stdio.h> #include <stdlib.h> #include <omp.h> int main(int argc, char* argv[]) { int i, n, sum, sum1, sum2; int a[100]; n=100; for(i=0; i<n; i++) { a[i]=i+1; } sum=0; sum1=0; sum2=0; #pragma omp parallel #pragma omp sections { #pragma omp section for(i=0; i<(n/2); i++) { sum1= sum1+ (a[i]*a[i]); } #pragma omp section for(i=(n/2); i<n; i++) { sum2= sum2+ (a[i]*a[i]); } } #pragma omp master { sum= sum1 +sum2; printf("Sum : %d",sum); } return 0; }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.12 sec, absolute running time: 0.16 sec, cpu time: 0.07 sec, memory peak: 5 Mb, absolute service time: 0,32 sec
edit mode
|
history
|
discussion
Sum : 338350