transpose of matrix in C Program

//transpose of matrix //transpose of matrix #include<stdio.h> #include<conio.h> #define ROWS 3 #define COLS 3 int main(void) { int a[ROWS][COLS]={{1,2,3},{4,5,6},{7,8,9}}; int i,j,tmp; for(i=1;i<ROWS;i++) { for (j=0;j<COLS;j++) { tmp=a[i][j]; a[i][j]=a[j][i]; a[j][i]=tmp; } } printf("TRANSPOSE of Matrix\n"); for(i=0;i<ROWS;i++) { for(j=0;j<COLS;j++) printf("%d",a[i][j]); printf("\n"); } …

Read More........

Compare two String function in C Program

//compare string #include<stdio.h> #include<conio.h> #include<string.h> main() { char str1[10],str2[10]; printf("input first string:"); scanf("%s",str1); printf("input second string:"); scanf("%s",str2); if(strcmp(str1,str2)==0) { printf("Both %s and %s are same",str1,str2); } else if (strcmp(str1,str2)>0) { printf("%s is greater than %s",str1,str2); } else { printf("%s lesser …

Read More........