Bubble Sort Count Vowels, Constant, Space Matrix Multiplication Matrixs Addition
Bubble Sort Count Vowels, Constant, Space Matrix Multiplication Matrixs Addition
Quadratic Equation Factorial of a Number Sort n Numbers Sum and average of array
#include <math.h> #include<stdio.h> #include <stdio.h> #include <stdio.h>
#include <stdio.h> long int multiplyNumbers(int n); void sorting(int numbers[],int num) { int main()
int main() int main() { int temp; {
{ int n; for (int i = 0; i < num; i++) { int i=0, sum=0, avg, in, size, num;
double a, b, c, discriminant, root1, root2, printf("Enter a positive integer: "); for (int j = i+1; j < num; j++) { int array[size];
realPart, imagPart; scanf("%d",&n); if (numbers[i]>numbers[j]) { printf("Enter the number elements in the
printf("Enter coe cients a, b and c: "); printf("Factorial of %d = %ld", n, temp=numbers[i]; array :");
scanf("%lf %lf %lf", &a, &b, &c); multiplyNumbers(n)); numbers[i]=numbers[j]; scanf("%d",&size);
discriminant = b * b - 4 * a * c; return 0; numbers[j]=temp; for (int i = 0; i < size; i++)
if (discriminant > 0) { } } {
root1 = (-b + sqrt(discriminant)) / (2 * a); long int multiplyNumbers(int n) { } printf("Enter the %d value :",i+1);
root2 = (-b - sqrt(discriminant)) / (2 * a); if (n>=1) } scanf("%d",&array[i]);
printf("root1 = %.2lf and root2 = %.2lf", return n*multiplyNumbers(n-1); printf("\nAll number sorted in assending order.\n"); }
root1, root2); else for (int k = 0; k < num; k++) { for(i=0;i<size;i++)
} return 1; printf("%d\n",numbers[k]); {
else if (discriminant == 0) { } } in = array[i];
root1 = root2 = -b / (2 * a); Palindrome or not printf("Assending order sorting is completed. sum = sum + in;
printf("root1 = root2 = %.2lf;", root1); #include <stdio.h> \n\n"); }
} int main() { } avg = sum/size;
else { int n, reversed = 0, remainder, original; int main() { printf("The sum of the elements in array is
realPart = -b / (2 * a); printf("Enter an integer: "); int numbers[100],num; %d\n",sum);
imagPart = sqrt(-discriminant) / (2 * a); scanf("%d", &n); char check; printf("The average of the elements in array is
printf("root1 = %.2lf+%.2l and root2 = original = n; printf("Enter how many numbers you want to %d\n",avg);
%.2f-%.2 ", realPart, imagPart, realPart, while (n != 0) { sort:"); }
imagPart); remainder = n % 10; scanf("%d",&num);
} reversed = reversed * 10 + remainder; printf("Enter the numbers for sorting.\n");
return 0; n /= 10; for (int i = 0; i < num; i++) {
} } printf("Enter the %d value :",i);
if (original == reversed) scanf("%d",&numbers[i]);
printf("%d is a palindrome.", original); }
else sorting(numbers,num);
printf("%d is not a palindrome.", original); }
return 0;
}
fi
fi
fi
ffi
fi
fi
fi
fi
Matrixs Subtraction Matrix Transposal TRACE OF MATRIX Factorial of a Number Using Recursion
#include <stdio.h> #include <stdio.h> #include <stdio.h> #include<stdio.h>
int main() int main() { #include <math.h> long int multiplyNumbers(int n);
{ int a[10][10], transpose[10][10], r, c; int main() {
int m, n, c, d, rst[10][10], second[10][10], printf("Enter rows and columns: "); int main () int n;
di erence[10][10]; scanf("%d %d", &r, &c); { printf("Enter a positive integer: ");
printf("Enter the number of rows and columns of printf("\nEnter matrix elements:\n"); static int array[10][10]; scanf("%d",&n);
matrix\n"); for (int i = 0; i < r; ++i) int i, j, m, n, sum = 0, sum1 = 0, a = 0, normal; printf("Factorial of %d = %ld", n,
scanf("%d%d", &m, &n); for (int j = 0; j < c; ++j) { printf("Enter the order of the matrix\n"); multiplyNumbers(n));
printf("Enter the elements of rst matrix\n"); printf("Enter element a%d%d: ", i + 1, j + 1); scanf("%d %d", &m, &n); return 0;
for (c = 0; c < m; c++) scanf("%d", &a[i][j]); printf("Enter the n coe cients of the matrix \n"); }
for (d = 0 ; d < n; d++) } for (i = 0; i < m; ++i) long int multiplyNumbers(int n) {
scanf("%d", & rst[c][d]); printf("\nEntered matrix: \n"); { if (n>=1)
printf("Enter the elements of second matrix\n"); for (int i = 0; i < r; ++i) for (j = 0; j < n; ++j) return n*multiplyNumbers(n-1);
for (c = 0; c < m; c++) for (int j = 0; j < c; ++j) { { else
for (d = 0; d < n; d++) printf("%d ", a[i][j]); scanf("%d", &array[i][j]); return 1;
scanf("%d", &second[c][d]); if (j == c - 1) a = array[i][j] * array[i][j]; }
printf("Di erence of entered matrices:-\n"); printf("\n"); sum1 = sum1 + a; Decimal to binary
for (c = 0; c < m; c++) { } } #include <stdio.h>
for (d = 0; d < n; d++) { for (int i = 0; i < r; ++i) } void decToBinary(int n) {
di erence[c][d] = rst[c][d] - second[c][d]; for (int j = 0; j < c; ++j) { normal = sqrt(sum1); int binaryNum[56];
printf("%d\t",di erence[c][d]); transpose[j][i] = a[i][j]; printf("The normal of the given matrix is = int i = 0;
} } %d\n", normal); while (n > 0) {
printf("\n"); printf("\nTranspose of the matrix:\n"); for (i = 0; i < m; ++i) binaryNum[i] = n % 2;
} for (int i = 0; i < c; ++i) { n = n / 2;
return 0; for (int j = 0; j < r; ++j) { sum = sum + array[i][i]; i++;
} printf("%d ", transpose[i][j]); } }
if (j == r - 1) printf("Trace of the matrix is = %d\n", sum); for (int j = i - 1; j >= 0; j--)
printf("\n"); } printf("%d", binaryNum[j]);
} }
return 0; int main() {
} int n;
printf("Enter an integer: ");
scanf("%d", &n);
decToBinary(n);
return 0;
}
Students Details Structure Fibinocii Series Product details structure Linear search
#include <stdio.h> #include<stdio.h> #include <stdio.h> #include<stdio.h>
struct student { void bonacciSeries(int range){ struct student { int main() {
char name[50]; int a=0, b=1, c; int index; int a[]={4,5,6,7,8,9};
char address[50]; while (a<=range) { char name[50]; int i=0;
char dob[50]; printf("%d\t", a); int price; int decision=0;
}; c = a+b; int quantity; int n;
int main() { a = b; } s[2]; printf("Enter the search element :");
struct student s; b = c; int main() { scanf("%d",&n);
printf("Enter The Information of Students :\n"); } int i, pp=0,tp=0; while(I<=5) {
printf("Enter Name : "); } printf("Enter information of products:\n"); if(n==a[I]) {
scanf("%s",s.name); int main() { for (i = 0; i < 2; ++i) { decision++;
printf("Enter the address of the student : "); int range; s[i].index = i + 1; }
scanf("%s",s.address); printf("Enter range: "); printf("\nFor product number%d,\n", i++;
printf("Enter the date of birth of the student : "); scanf("%d", &range); s[i].index); }
scanf("%s",s.dob); printf("The bonacci series is: \n"); printf("Enter name: "); if(decision==0) {
printf("\nDisplaying Information\n"); bonacciSeries(range); scanf("%s",s[i].name); printf("The search element is not present");
printf("Name: %s\n",s.name); return 0; printf("Enter price: "); }
printf("Address: %s\n",s.address); } scanf("%d",&s[i].price); else if(decision>1) {
printf("Date of birth: %s\n",s.dob); Concatenate Two Strings printf("Enter quantity: "); printf("The search element is present, %d
return 0; #include <stdio.h> scanf("%d", &s[i].quantity); times.",decision+1);
} int main() { } }
Reverse a number char s1[100] = "programming ", s2[] = "is printf("Displaying Information:\n\n"); }
#include <stdio.h> awesome"; for (i = 0; i < 2; ++i) {
int main() { int length, j; printf("\nProduct number: %d\n", i + 1);
int n, reverse = 0, remainder; length = 0; printf("Product Name: ");
printf("Enter an integer: "); while (s1[length] != '\0') { puts(s[i].name);
scanf("%d", &n); ++length; printf("Product quantity: %d",s[i].quantity);
while (n != 0) { } printf("Product price: %d", s[i].price);
remainder = n % 10; for (j = 0; s2[j] != '\0'; ++j, ++length) { printf("\n");
reverse = reverse * 10 + remainder; s1[length] = s2[j]; pp=s[i].price*s[i].quantity;
n /= 10; } tp=tp+pp;
} s1[length] = '\0'; }
printf("Reversed number = %d", reverse); printf("After concatenation: "); printf("\n");
return 0; puts(s1); printf("Total price in %d",tp);
} return 0; return 0;
} }
ff
fi
fi
ff
ff
fi
fi
fi
ff
fi
ffi
fi