Tuesday, November 29, 2022

Calculate time for a Program

 #include<conio.h>

#include<stdio.h>

#include<time.h>

#include<dos.h>

void main()

{


int a[10][10],b[10][10],c[10][10],i,j,r,l;

time_t start, end;

double tot_time;

clrscr();

start=clock();

printf("enter no. of rows=");

scanf("%d",&r);

printf("enter no. of columns=");

scanf("%d",&l);

for(i=0;i<r;i++)

for(j=0;j<l;j++)

scanf("%d",&a[i][j]);

for(i=0;i<r;i++)

for(j=0;j<l;j++)

scanf("%d",&b[i][j]);

for(i=0;i<r;i++)

for(j=0;j<l;j++)

c[i][j]=a[i][j]+b[i][j];

printf("%d", c[i][j]);

delay(50):

printf("\n");

end=clock();

tot_time=((double) (end-start))/CLOCKS_PER_SEC;

printf("'In time=%f",tot_time);

getch();

}


No comments:

Post a Comment