Posts

Showing posts with the label practice questions

Data Structures Lab -CSL 201- Practice questions - KTU 2019 scheme

********************************************************************************** 1. Write a program to read two polynomials and store them in an array. Calculate the sum of the two polynomials and display the first polynomial, second polynomial and the resultant polynomial. #include<stdio.h> void create(int poly[],int degree) {     int i=0;          printf("Enter the coeffecients for:\n");     for(i=degree;i>=0;i--)     {         printf("Exp_%d: ",i);         scanf("%d",&poly[i]);     } } void display(int poly[],int degree) {     int i;     for(i=degree;i>=0;i--)     {                  if(i!=degree && poly[i]>0)         {              printf("+");          }         printf("%dx^%d",poly[i],i);     } } void main() {     int poly1[100]={0},degree1,poly2[100]={0},degree2,degreeresult,polyresult[100],i=0;          printf("Enter the degree of first polynomial");      scanf("%d",&degree1);