Transpose of a matrix in C

#include <stdio.h> int main() { int matrix[10][10], transpose[10][10], row, col, i, j; printf("Enter rows and columns: "); scanf("%d %d", &row, &col); printf("\nEnter matrix elements:\n"); for (i = 0; i < row; ++i) for (j = 0; j < col; ++j) { printf("Enter element a%d%d: ", i + 1, j + 1); scanf("%d", &matrix[i][j]); } printf("\nEntered... Continue Reading →

Matrix Addition in C

#include <stdio.h> int main() { int row, col, mat1[100][100], mat2[100][100], matsum[100][100], i, j; printf("Enter the number of rows: "); scanf("%d", &row); printf("Enter the number of columns"); scanf("%d", &col); printf("\nEnter elements of 1st matrix:\n"); for (i = 0; i < row; ++i) for (j = 0; j < col; ++j) { printf("Element a%d%d: ", i +... Continue Reading →

Hosoya’s Triangle or Fibonacci Triangle in C

The Hosoya's triangle (originally Fibonacci triangle) is a triangular arrangement of numbers as it is shown in pascal triangle based on the Fibonacci series. #include<stdio.h> #include<stdlib.h> int main(){ int a=0,b=1,i,c,n,j; system("cls"); printf("Enter the number of lines you want:"); scanf("%d",&n); for(i=1;i<=n;i++) { a=0; b=1; printf("%d\t",b); for(j=1;j<i;j++) { c=a+b; printf("%d\t",c); a=b; b=c; } printf("\n"); } return 0; }

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started