Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
CO Assignment 1 Question 4
#include<stdlib.h> #include<stdio.h> #include<time.h> int main() { clock_t start,end; double cpuTimeUsed; int i,j,k,c,d,sum=0; FILE * fp; fp = fopen ("CO_output.csv","w"); for( i=10;i<250;i++) { int a[i][i],b[i][i]; for ( j = 0; j < i; ++j) { for ( k = 0; k < i; ++k) { b[j][k]=0; } } int count=0; for (j = 0; j < i; ++j) { for ( k = 0; k < i; ++k) { a[j][k]=count++; if(count==10) count=0; } } start=clock(); for (c = 0; c < i; c++) { for ( d = 0; d < i; d++) { for ( k = 0; k < i; k++) { sum = sum + a[c][k]*a[k][d]; } b[c][d] = sum; sum = 0; } } end=clock(); cpuTimeUsed=((double)(end-start))/CLOCKS_PER_SEC; //printf("%d\t%lf\n",i,cpuTimeUsed); fprintf (fp,"%d,%lf\n",i,cpuTimeUsed ); } }
run
|
edit
|
history
|
help
0
Day Of The Programmer
Swiss Infotech Tutorial
2.1.3 Sum of squares of first hundred natural numbers with different cores
a.out
Assignment 4 v3
formatting_input_and_output
child process
4
HW22
hwkpractice