Results for: int

Program for bubble sort using swap?

#include<stdio.h> #include<conio.h> int *bubble(int a[],int n); int *y; int j,i; void main() { int value[]={10,2,3,5,9,6,2,3,6,8}; int n; clrscr(); n=sizeof(value)/sizeof(int); y=bubble(value,n); for(i=0;i<n;i++) { printf("%d\n",*y++); } getch(); } int *bubble(int a[],int n) { int t; for(i=0;i<n-1;i++) { for(j=0;j<n-i;j++) { if(a[j]<=a[j+1]) { t=a[j]… Full Answer

C program to add two matrices using pointers?

#include<stdio.h> #include<stdlib.h> int** addMatrices(int**,int**,int,int); int main() { int **a;int **a1;int **a2; int i,j,m,n; printf("Enter the number of rows and columns\n"); scanf("%d",&m); scanf("%d",&n); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } a2=addMatrices(**a,**a1,m,n); for(i=0;i<m;i++) { for(j=0;j<n;j++)… Full Answer

Write a program to multiply two polynomials using an array?

#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)… Full Answer