The formula to calculate the product of two variables ( P_1 ) and ( P_2 ) is simply ( P_1 \times P_2 ). If you're looking for a specific context or application, such as in physics or economics, please provide more details for a tailored response.
#include<stdio.h> #include<conio.h> void main() { clrscr(); int i; int a[4]={1,2,3,4}; int *p1,*p2,*p3; for(i=0;i<4;i++) { p1=&a[0]; p2=&a[2]; p3=*p2-*p1; printf("\n value of p3%d",p3); } getch(); }
Using the formula for circumference, the diameter can be found. The formula is C = Pi x D where Pi = 3.1416 and D = Diameter. C = Pi x D (sub with known numbers) 25.12 = 3.1416 x D (divide both sides by Pi) 25.12 ÷ 3.1416 = D 7.9959 = D
Formula for Circumference of a circle is C = pdC = d+94 therefored+94 = pd1 + 94/d = p1 + 94/d = 3.142d = 43.884cmd = 2rr = 21.942cm, C = 137.884cmAll figures rounded to 3 decimal places
Yes. you can use a calculator in the P2 of the mathematics D (calculator version) O level paper but you are strictly prohibited to use it in P1. Also, there are a set of instructions you have to abide by while selecting the calculator for example it should be non-graphical and non-programmable. You can refer to the syllabus of this subject of Cambridge's site for further details.
Given the formula D = ABC, what is the formula for C?Answer: C = D ÷ AB
void PrintTwinPrimes (int p1, int p2) { printf ("%d and %d are twin-primes\n", p1, p2); }
A pointer can point to address of another pointer. consider the exampleint x=456, *p1, **p2;p1 = &x;p2 = &p1;Copyright Einstein College of EngineeringDepartment of Civil EngineeringTOPprintf("%d", *p1); will display value of x 456.printf("%d", *p2); will also display value of x 456. This is because p2 point p1, and p1 points x.Therefore p2 reads the value of x through pointer p1. Since one pointer is points towards anotherpointer it is called chain pointer. Chain pointer must be declared with ** as in **p2
#include<stdio.h> #include<conio.h> void main() { clrscr(); int i; int a[4]={1,2,3,4}; int *p1,*p2,*p3; for(i=0;i<4;i++) { p1=&a[0]; p2=&a[2]; p3=*p2-*p1; printf("\n value of p3%d",p3); } getch(); }
The Momentum Law is Newton's 3 rd Law Action-Reaction,The sum of the forces is zero. 0 = F1 + F2 = d(p1 +p2)/dt gives teh Momentum Law: p1 + p2 = constant.
Mass flow in air can be calculated if you know the pressure drop across the pipe. Then it can be calculated using Darcy's Equation for Pressure,which is: P2-P1 = (4fLv*v)/d*2*g where, P2 & P1 are pressures at two points in pipe, f = friction factor, L= length of pipe, v = velocity of fluid, d = diameter of pipe, g = gravity. from this formula we can calculate the velocity and hence the flow rate.
The segregation formula, often referred to in the context of urban studies or social sciences, measures the degree to which different groups (such as racial or ethnic groups) are separated within a given area. One common formula used is the Index of Dissimilarity (D), which quantifies segregation by comparing the distribution of two groups across different geographic areas. It ranges from 0 (complete integration) to 1 (complete segregation). The formula is calculated as D = 0.5 * Σ |(P1i / P1) - (P2i / P2)|, where P1i and P2i are the populations of groups 1 and 2 in area i, and P1 and P2 are the total populations of groups 1 and 2, respectively.
#include <stdio.h> #include <conio.h> #define MAX 10 struct term { int coeff ; int exp ; } ; struct poly { struct term t [10] ; int noofterms ; } ; void initpoly ( struct poly *) ; void polyappend ( struct poly *, int, int ) ; struct poly polyadd ( struct poly, struct poly ) ; struct poly polymul ( struct poly, struct poly ) ; void display ( struct poly ) ; void main( ) { struct poly p1, p2, p3 ; clrscr( ) ; initpoly ( &p1 ) ; initpoly ( &p2 ) ; initpoly ( &p3 ) ; polyappend ( &p1, 1, 4 ) ; polyappend ( &p1, 2, 3 ) ; polyappend ( &p1, 2, 2 ) ; polyappend ( &p1, 2, 1 ) ; polyappend ( &p2, 2, 3 ) ; polyappend ( &p2, 3, 2 ) ; polyappend ( &p2, 4, 1 ) ; p3 = polymul ( p1, p2 ) ; printf ( "\nFirst polynomial:\n" ) ; display ( p1 ) ; printf ( "\n\nSecond polynomial:\n" ) ; display ( p2 ) ; printf ( "\n\nResultant polynomial:\n" ) ; display ( p3 ) ; getch( ) ; } /* initializes elements of struct poly */ void initpoly ( struct poly *p ) { int i ; p -> noofterms = 0 ; for ( i = 0 ; i < MAX ; i++ ) { p -> t[i].coeff = 0 ; p -> t[i].exp = 0 ; } } /* adds the term of polynomial to the array t */ void polyappend ( struct poly *p, int c, int e ) { p -> t[p -> noofterms].coeff = c ; p -> t[p -> noofterms].exp = e ; ( p -> noofterms ) ++ ; } /* displays the polynomial equation */ void display ( struct poly p ) { int flag = 0, i ; for ( i = 0 ; i < p.noofterms ; i++ ) { if ( p.t[i].exp != 0 ) printf ( "%d x^%d + ", p.t[i].coeff, p.t[i].exp ) ; else { printf ( "%d", p.t[i].coeff ) ; flag = 1 ; } } if ( !flag ) printf ( "\b\b " ) ; } /* adds two polynomials p1 and p2 */ struct poly polyadd ( struct poly p1, struct poly p2 ) { int i, j, c ; struct poly p3 ; initpoly ( &p3 ) ; if ( p1.noofterms > p2.noofterms ) c = p1.noofterms ; else c = p2.noofterms ; for ( i = 0, j = 0 ; i <= c ; p3.noofterms++ ) { if ( p1.t[i].coeff p2.t[j].exp ) { p3.t[p3.noofterms].coeff = p1.t[i].coeff + p2.t[j].coeff ; p3.t[p3.noofterms].exp = p1.t[i].exp ; i++ ; j++ ; } else { p3.t[p3.noofterms].coeff = p1.t[i].coeff ; p3.t[p3.noofterms].exp = p1.t[i].exp ; i++ ; } } else { p3.t[p3.noofterms].coeff = p2.t[j].coeff ; p3.t[p3.noofterms].exp = p2.t[j].exp ; j++ ; } } return p3 ; } /* multiplies two polynomials p1 and p2 */ struct poly polymul ( struct poly p1, struct poly p2 ) { int coeff, exp ; struct poly temp, p3 ; initpoly ( &temp ) ; initpoly ( &p3 ) ; if ( p1.noofterms != 0 && p2.noofterms != 0 ) { int i ; for ( i = 0 ; i < p1.noofterms ; i++ ) { int j ; struct poly p ; initpoly ( &p ) ; for ( j = 0 ; j < p2.noofterms ; j++ ) { coeff = p1.t[i].coeff * p2.t[j].coeff ; exp = p1.t[i].exp + p2.t[j].exp ; polyappend ( &p, coeff, exp ) ; } if ( i != 0 ) { p3 = polyadd ( temp, p ) ; temp = p3 ; } else temp = p ; } } return p3 ; }
#include<stdio.h> #include<stdlib.h> void display(float **,int); float** add(float **,float **,int,int,int); int main() { float **p1,**p2,**p3,**p4; int i,j,n1,n2,k=0,x; printf("Enter no of terms of a pollynomial:\n"); scanf("%d",&n1); printf("Enter no of terms of another pollynomial:\n"); scanf("%d",&n2); p1=(float **) malloc(n1*sizeof(float *)); p2=(float **) malloc(n2*sizeof(float *)); for(i=0;i<n1;i++) p1[i]=(float *) malloc(2*sizeof(float)); for(i=0;i<n2;i++) p2[i]=(float *) malloc(2*sizeof(float)); printf("Enter the first pollynomial:\n"); for(i=0;i<n1;i++) { printf("\nEnter value and exponent:"); scanf("%f %f",&p1[i][0],&p1[i][1]); } printf("Enter the second pollynomial:\n"); for(i=0;i<n2;i++) { printf("\nEnter value and exponent:"); scanf("%f %f",&p2[i][0],&p2[i][1]); } printf("\nFirst pollynomial:\n"); display(p1,n1); printf("\nSecond pollynomial:\n"); display(p2,n2); for(i=0;i<n1;i++) for(j=0;j<n2;j++) if(p1[i][1]==p2[j][1]) k++; x=n1+n2-k; p3=add(p1,p2,n1,n2,x); printf("\nAdded polynomial:\n"); display(p3,x); return 0; } void display(float **p,int n) { int i; printf("%fx^%d",p[0][0],(int)p[0][1]); for(i=1;i<n;i++) printf("+%fx^%d",p[i][0],(int)p[i][1]); } float** add(float **p1,float **p2,int n1,int n2,int n) { int i,j,k; float **p3; p3=(float **)malloc(n*sizeof(float*)); for(i=0;i<n;i++) p3[i]=(float *)malloc(2*sizeof(float)); i=0; j=0; k=0; while(i<n1 && j<n2) { if(p1[i][1]==p2[j][1]) { p3[k][0]=p1[i][0]+p2[j][0]; p3[k][1]=p1[i][1]; k++; i++; j++; } else if(p1[i][1]<p2[j][1]) { p3[k][0]=p1[i][0]; p3[k][1]=p1[i][1]; k++; i++; } else { p3[k][0]=p2[j][0]; p3[k][1]=p2[j][1]; k++; j++; } } while(i<n1) { p3[k][0]=p1[i][0]; p3[k][1]=p1[i][1]; k++; i++; } while(j<n2) { p3[k][0]=p2[j][0]; p3[k][1]=p2[j][1]; k++; j++; } return p3; }
#include<stdio.h> #include<malloc.h> int* getpoly(int); void showpoly(int *,int); int* addpoly(int *,int,int *,int); int* mulpoly(int *,int,int *,int); int main(void) { int *p1,*p2,*p3,d1,d2,d3; /*get poly*/ printf("\nEnter the degree of the 1st polynomial:"); scanf("%d",&d1); p1=getpoly(d1); printf("\nEnter the degree of the 2nd polynomial:"); scanf("%d",&d2); p2=getpoly(d2); printf("Polynomials entered are\n\n"); showpoly(p1,d1); printf("and\n\n"); showpoly(p2,d2); /*compute the sum*/ d3=(d1>=d2?d1:d2); p3=addpoly(p1,d1,p2,d2); printf("Sum of the polynomials is:\n"); showpoly(p3,d3); /*compute product*/ p3=mulpoly(p1,d1,p2,d2); printf("Product of the polynomials is:\n"); showpoly(p3,d1+d2); } int* getpoly(int degree) { int i,*p; p=malloc((1+degree)*sizeof(int)); for(i=0;i<=degree;i++) { printf("\nEnter coefficient of x^%d:",i); scanf("%d",(p+i)); } return(p); } void showpoly(int *p,int degree) { int i; for(i=0;i<=degree;i++) printf("%dx^%d + ",*(p+i),i); printf("\b\b\b "); printf("\n"); } int* addpoly(int *p1,int d1,int *p2,int d2) { int i,degree,*p; degree=(d1>=d2?d1:d2); p=malloc((1+degree)*sizeof(int)); for (i=0;i<=degree;i++) if((i>d1) && (i<=d2)) *(p+i)=*(p2+i); else if((i>d2) && (i<=d1)) *(p+i)=*(p1+i); else *(p+i)=*(p1+i)+*(p2+i); return(p); } int* mulpoly(int *p1,int d1,int*p2,int d2)/* this is the function of concern*/ { int i,j,*p; p=malloc((1+d1+d2)*sizeof(int)); for(i=0;i<=d1;i++) for(j=0;j<=d2;j++) p[i+j]+=p1[i]*p2[j]; return(p); }
it is impossible to calculate the dia without velocity. But for the details you have given we can apply the haigen poisuells law p1-p2=32Mul/d^2 where p1-p2=pressure drop M=viscosity l=length d=dia u=avg velocity umax/2=uavg
POLYNOMIAL ADDITION#include#includetypedef struct poly{int coeff;int expo;}p;p p1[10],p2[10],p3[10];void main(){int t1,t2,t3,k;int read(p p1[10]);int add(p p1[10],p p2[10],int t1,int t2,p p3[10]);void print(p p2[10],int t2);void printo(p pp[10],int t2);clrscr();t1=read(p1);print(p1,t1);t2=read(p2);print(p2,t2);t3=add(p1,p2,t1,t2,p3);printo(p3,t3);getch();}int read(p p[10]){int t1,i;printf("\n Enter the total no of terms");scanf("%d",&t1);printf("\n Enter the coeff and expo in descending order");for(i=0;i
I'm assuming the plane is in 3-space, but this easily generalizes... P1 = (x1,y1,z1) P2 = (x2,y2,z2) P3 = (x3,y3,z3) Let v1 = P2-P1 = (x2-x1,y2-y1,z2-z1), a vector from the origin and similarly let v2 = P3-P2 = (x3-x2,y3-y2,z3-z2) Then, for real constants s,t , the plane is spanned by D + s v1 + t v2 = 0, for some constant D