Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C #36

Open
wants to merge 5 commits into
base: c
Choose a base branch
from
Open

C #36

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions e10.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int main()
{

int num1[10],i,avg,add=0;
printf("Enter number 10nos");
for(i=0;i<10;i++)
{scanf("%d",&num1[i]);
add=add+num1[i];
}
avg=add/10;

printf("Average is %d ",avg);

return 0;
}
41 changes: 41 additions & 0 deletions h2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include<stdio.h>
#include<stdlib.h>
void main()
{ int **arr,row,col,i,j,count,**art,ctr;
printf("Enter row and column\n");
scanf("%d%d",&row,&col);
count=0;ctr=0;
arr=(int**)malloc(sizeof(int)*row);
for(i=0;i<row;i++)
arr[i]=(int*)malloc(sizeof(int)*col);
printf("Enter element row-wise\n");
for(i=0;i<row;i++)
for(j=0;j<col;j++)
{scanf("%d",&arr[i][j]);
if(arr[i][j]!=0)
count++;
}
art=(int**)malloc(sizeof(int)*(count+1));
for(i=0;i<(count+1);i++)
art[i]=(int*)malloc(sizeof(int)*3);

art[ctr][0]=row;
art[ctr][1]=col;
art[ctr][2]=count;

for(i=0;i<row;i++)
for(j=0;j<col;j++)
if(arr[i][j]!=0)
{ ctr++;
art[ctr][0]=i;
art[ctr][1]=j;
art[ctr][2]=arr[i][j];
}
printf("\n\t\t3 notation sparse matrix \n");
for(i=0;i<count+1;i++)
{ printf("\n");
for(j=0;j<3;j++)
printf("%d",art[i][j]);
}
getch();
}
16 changes: 16 additions & 0 deletions m8.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>

int main()
{

int num1,num2, max;
printf("Enter two number to get the largest:")
scanf("%d",&num1);
scanf("%d",&num2);
max = (num1 > num2) ? num1 : num2;


printf("Largest number is %d ",max);

return 0;
}
11 changes: 11 additions & 0 deletions p3_i.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include<stdio.h>

int main()
{int i;
for(i=1;i<6;i++)
{printf("\n");
for(int j=0;j<i;j++)
printf("*");
}
return 0;
}