Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 2

#include<stdio.

h>
#include<malloc.h>
#include<stdlib.h>
int **a;
int i,j;
int intput(int **,int,int);
int disp(int **,int,int);
main()
{
int n,m=4;
printf("\n enter the number of task: \n");
scanf("%d",&n);
/*printf("\n enter the number of attributes of the tasks: \n");
scanf("%d",&m);*/
a=(int**)malloc(n*sizeof(int*));
for(i=0;i<n;i++)
{
a[i]=(int*)malloc(m*sizeof(int));
}
input(a,n,m);
disp(a,n,m);
}
int input(int **a,int n,int m)
{
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(j==0)
printf("\n enter the %d task's serial number: ",i);
else if(j==1)
printf("\n enter the %d task's execution time",i);
else if(j==2)
printf("\n enter the %d task's period ",i);
else if(j==3)
printf("\n enter the %d task's deadline",i);
else
{
printf("\n Somewhere wrong in your input.......\n the program is
exiting....");
exit(0);
}
scanf("%d",&a[i][j]);
}
}
return 1;
}
int disp(int **a,int n,int m)
{
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
return 1;
}

You might also like