Chat with our AI personalities
# include <stdio.h> # include <conio.h> # include <stdlib.h> # define sz 20 # define INF 200000 void print(unsigned long s[][sz], int i, int j) { if (i == j) printf(" A%d ",i); else { printf(" ( "); print(s, i, s[i][j]); print(s, s[i][j] + 1, j); printf(" ) "); } } void printm(unsigned long m[][sz], int n) { int i,j; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { printf("%5d",m[i][j]); } printf("\n\n"); } printf("\nThe No. of multiplication required is : %d",m[1][n]); } void Matrix_Chain_Order(int p[],int num) { unsigned long m[sz][sz] = {0}; unsigned long s[sz][sz] = {0}; unsigned int q = 0; int i, j, k, l; int n = num; for(i = 1; i <= n; i++) m[i][i] = 0; for(l = 2; l <= n; l++) for(i = 1; i <= (n - l + 1); i++) { j = i + l - 1; m[i][j] = INF; for(k = i; k <= j - 1; k++) { q = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]; if(q < m[i][j]) { m[i][j] = q; s[i][j] = k; } } } print(s, i-1, j); printf("\n\n"); printf("The Minimum No. of Multiplication Required is:\n\n"); printm(m,n); } void main() { int i,num=0,p[sz]={0}; clrscr(); printf("Enter the number of matrix : "); scanf("%d",&num); printf("Enter %d no. of order sequence for %d matrix :\n",num+1,num); for(i=0;i<=num;i++) scanf("%d",&p[i]); printf("\n\n"); printf("MULTIPLICATION SEQUENCE IS : "); printf("\n\n\t"); Matrix_Chain_Order(p,num); getch(); }
The sum of the three kids ages is 41. So we can say that S+J+L=41 We know that Leah is years older than Sue. So we can write her age as L=S+6. We also know that John is 5 years older than Leah. So we can write his age as J=L+5 Since L=S+6 we can write J as S+6+5 or J=S+11 Now we have all three kids ages as terms of Sue's age. S S+6 S+11 Now we add those together and set them equal to 41. 3S+17=41 3S=24 S=8 Sue is 8 years old.
#include<stdio.h> #include<conio.h> void main() { int i,a[3][3]={1,2,3,4,5,6,7,8,9},j,s=0,m,n; clrscr(); /*for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("\na[%d][%d]= ",i,j); scanf("%d",&a[i][j]); } }*/ for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("%d",a[i][j]); } printf("\n\n"); } for(i=0;i<3;i++) { for(j=0;j<3;j++) s=s+a[i][j]; printf("\n Sum of %d`th row=%d",i+1,s); s=0; } { int i,j,s=0; for(j=0;j<3;j++) { for(i=0;i<3;i++) s=s+a[i][j]; printf("\n\t\t Sum of %d`th column=%d",j+1,s); s=0 ; } } getch(); }
a b d e f F g G j J k L m n N p P q Q r R s S t u y z Z
I thinks that might be r k r j s k s j t k Repeats the sequence of the letter rr ss tt. . . . and k...j ... k ... j ... k ... j ... k ---> line 1 r......r.....s....s.....t.... ---> line 2 Match line 1 with line 2. I hope it is clear and correct.