Ikr? But I have to do it for the university assignments :โ ^โ )
Flag: | India |
Registered: | May 22, 2022 |
Last post: | November 15, 2024 at 9:48 PM |
Posts: | 166 |
Ikr? But I have to do it for the university assignments :โ ^โ )
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define MAX 20
void init(int p[]);
void read(int p1[],int p2[]);
void print(int p[]);
void add(int p1[],int p2[],int p3[]);
void sub(int p1[],int p2[],int p3[]);
void multiply(int p1[],int p2[],int p3[]);
void main()
{
int p1[MAX],p2[MAX],p3[MAX];
int choice;
do
{
printf("\n 1. Creation of polynomials ");
printf("\n 2. Addition of polynomials ");
printf("\n 3. Substraction of polynomials ");
printf("\n 4. Multiplication of polynomials ");
printf("\n 5. EXIT ");
printf("\n 1. Please enter your choice ");
scanf("%d",&choice);
switch(choice)
{
case 1 : read(p1,p2);
break;
case 2 : add(p1,p2,p3);
printf("\n 1st Polynomial ");
print(p1);
printf("\n 2nd Polynomial ");
print(p2);
printf("\n Sum of given polynomials : ");
print(p3);
break;
case 3 : sub(p1,p2,p3);
printf("\n 1st Polynomial ");
print(p1);
printf("\n 2nd Polynomial ");
print(p2);
printf("\n Substraction of given polynomials : ");
print(p3);
break;
case 4 : multiply(p1,p2,p3);
printf("\n 1st Polynomial ");
print(p1);
printf("\n 2nd Polynomial ");
print(p2);
printf("\n Multiplication of given polynomials : ");
print(p3);
break;
}
}
while(choice!=5);
}
void read(int p1[],int p2[])
{
int n,i,power1,coeff1,power2,coeff2;
init(p1);
printf("\n Enter number of terms : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n Enter the First term (power,coefficient) ");
scanf("%d%d",&power1,&coeff1);
p1[power1]=coeff1;
}
init(p2);
printf("\n Enter number of terms : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n Enter the Second term (power,coefficient) ");
scanf("%d%d",&power2,&coeff2);
p2[power2]=coeff2;
}
}
void init(int p[])
{
int i;
for(i=0;i<MAX;i++)
p[i]=0;
}
void add(int p1[],int p2[],int p3[])
{
int i;
for(i=0;i<MAX;i++)
p3[i]=p1[i] + p2[i];
}
void sub(int p1[],int p2[],int p3[])
{
int i;
for(i=0;i<MAX;i++)
p3[i]=p1[i] - p2[i];
}
void multiply(int p1[],int p2[],int p3[])
{
int i,j,k;
for( i=0; i<=MAX; i++)
for( j=0; j<=MAX; j++)
k=i+j;
p3[k] = p3[k]+p1[i]*p2[j];
}
void print(int p[])
{
int i;
for(i=0;i<MAX;i++)
if(p[i]!=0)
printf("%dX^%d ",p[i],i);
}
Addition and substraction of polynomials is working fine but the multiplication isn't
Lmao we are about to get banged๐
God's squad vs boys out of Mumbai , either way india wins๐ฟ
This is either a hit or a miss with Cned.W nonetheless!
It dropped to 1.8k on big billion days sale๐
Oswald is a safety-conscious but fun-loving octopus who lives in an apartment complex in Big City with his dog, Weenie. His neighborhood is peopled with colorful characters like his pal, Henry the Penguin, Madame Butterfly, who runs the Big Diner, and her daughter, Catrina Caterpillar. Oswald likes to play the piano and sing, and he always does whatever he can to help his friends and neighbors.
"Bigger the mass๐ , bigger is the force of attraction"๐๐
God damn it! They still have to keep those bots ๐
They'll be announcing 3 more players right? since they are building a 10 man.
The team comp is a serious concern rn.
Agriculture a.k.a farming is the most important and favourite occupation of our region. Farmers harvest crops(baits) in off-season by sprinkling water (leaks) to attract customers(audience) for minimal costs(no contexts) and maximum returns(impressions).
Agriculture a.k.a farming is the most important and favourite occupation of our region. Farmers harvest crops(baits) in off-season by sprinkling water (leaks) to attract customers(audience) for minimal costs(no contexts) and maximum returns(impressions).
BLEED 13-1 GE kekw
Can't wait to see him making his brain-dead plays on lan lmao
Thanks for the info folks!
Any dates?
NGL this orangutan roster has the potential to represent APAC globally.
I like glitchpop.
Common Hudsen W
I like the black variant of the sovereign ghost.
Bruv you can't even compare these two.SkRossi runs like a headless chicken and dies.He buys operator with no shields in eco rounds, NGL he's good in 1v1 fights but you really can't see him doing good in clutch situations.On the other hand Kang Kang overshadows him in any aspects possible.
Yay
Sugar zero
Stax
Jingg
Boaster
Bruv i opened like 20 accounts just to get a good vandal or phantom skin, all I got is smite or nebula skins and 1 ion operator,wtf!! What are the odds of getting a good night market??I am pissed
Inshallah boys played well
Ain't my name kinda cringe O_o