answersLogoWhite

0

AllQ&AStudy Guides
Best answer

R--ph J--ps--n has written:

'The expounder expounded'

This answer is:
Related answers

R--ph J--ps--n has written:

'The expounder expounded'

View page

the logic i have used is nCr => n!/(r!*(n-r)!) for example the outer loop counter is 'n' and the inner loop counter is 'r' , then the corresponding element of the pascal's triangle will be nCr. keep in mind that both the loops will have to start from zero. #include<stdio.h> main()

{

int num,i,j,k,space;

int difffact=1,diff,n,r,x,y,comb=0,nfact=1,rfact=1;

printf("please enter the number of lines\n");

scanf("%d",&num); k=num-1;

space=num-1;

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

{

k=space--;

for(;k>0;k--)

{

printf(" ");

}

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

{

comb=0;

nfact=1;

rfact=1;

difffact=1; for(n=i;n>=1;n--)

nfact=nfact*n; for(r=j;r>=1;r--)

rfact=rfact*r; diff=i-j;

for(;diff>=1;diff--)

difffact=difffact*diff; comb=(nfact/(rfact*difffact));

printf("%d ",comb);

}

printf("\n");

}

}

View page

#include<stdio.h> #include<conio.h> void main() { clrscr(); int m[10][10]; int i,j,r,c; for (i=0;i<10;i++) { for (j=0;j<10;j++) { m[i][j]=0; } } printf("\n Enter size of row and colomn:"); scanf("%d %d",&r,&c); printf("\n Enter the two matrices: \n"); for (i=0;i<r;i++) { for (j=0;j<c;j++) { printf("Enter element %d %d of m1: ",(i+1),(j+1)); scanf("%d",&m[i][j]); } } printf("\n The matrix is: \n"); for (i=0;i<r;i++) { for (j=0;j<c;j++) { printf("%d ",m[i][j]); } printf("\n"); } printf("\n The transpose of the matrix is: \n"); for (i=0;i<r;i++) { for (j=0;j<c;j++) { printf("%d ",m[j][i]); } printf("\n"); } getch(); }

View page

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 2 words with the pattern N-N--J-R-. That is, nine letter words with 1st letter N and 3rd letter N and 6th letter J and 8th letter R. In alphabetical order, they are:

noninjury

nonmajors

View page

#include
#include

// Note: The code is not very good !!!! But, OK for understanding the concept
// of matrix addition using pointers !!!!!
void main ()
{
int data[2][2], data1[2][2];
int *p1,*p2,i,j;
clrscr();

for (i = 0; i <2;i++)
{
for(j=0;j<2;j++)
{
data[i][j] = i+j;
data1[i][j]= i+ 2*j;
}
}

p1 = data[0];
p2 = data1[0];

for (i = 0; i<2;i++)
{
for(j=0;j<2;j++)
{
printf ("data -- %d\t",p1[i]);
}
printf("\n");
}
for (i = 0; i<2;i++)
{
for(j=0;j<2;j++)
{
printf ("data1 -- %d\t",p2[i]);
}
printf("\n");
}
for (i = 0; i <2;i++)
{
for(j=0;j<2;j++)
{
printf ("Sum %d\t",p1[i]+p2[i]);
}
printf("\n");
}
getch();
}

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results