Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
ques4
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
Conversation opened. 1 read message. Skip to content Using Gmail with screen readers Search riya Click here to enable desktop notifications for Gmail. Learn more Hide Gmail COMPOSE Labels Inbox (5,212) Starred Important Sent Mail Drafts (2) Categories Personal Travel More Hangouts Move to Inbox More 2 of 50 Print all In new window Lalalalalala Inbox x Riya Jain Attachments11:42 PM (7 minutes ago) to me Q4 hai ye Attachments area Click here to Reply or Forward 0.88 GB (5%) of 15 GB used Manage Terms - Privacy Last account activity: 4 minutes ago Details // C program to multiply two square matrices. #include <stdio.h> #include<stdlib.h> #include<string.h> int N; //#define N 200 #include<time.h> // This function multiplies mat1[][] and mat2[][], // and stores the result in res[][] void multiply(int mat1[][N], int mat2[][N], int res[][N]) { int i, j, k; for (i = 0; i < N; i++) { for (j = 0; j < N; j++) { res[i][j] = 0; for (k = 0; k < N; k++) res[i][j] += mat1[i][k]*mat2[k][j]; } } } int main() { int size; FILE* fp; fp=fopen("Bookp.csv","w"); for(size=5;size<=1000;size=size+5){ N=size; double time; clock_t start; int mat1[N][N]; int mat2[N][N]; memset(mat1,0,4*N*N); memset(mat2,0,4*N*N); int p,q; for(p=0;p<N;p++) { for(q=0;q<N;q++) { mat1[p][q]=1; mat2[p][q]=1; } } int res[N][N]; // To store result int i, j; start=clock(); for(i=0;i<5;i++) { multiply(mat1, mat2, res); } time= (double)(clock()-start)/(CLOCKS_PER_SEC*5);///CLOCKS_PER_SEC; printf("\n\n Time:%.12f\n,size:%d\n\n",time,size); fprintf(fp,"%d,%d,%d,%.12f\n",N,N*N,3*N*N,time); } fclose(fp); return 0; }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
edit mode
|
history
|
discussion
stackse - search stackoverflow differently