Skip to main content

Posts

Search This Blog

matrix multiplication in c using functions and pointers

 #include <stdio.h> #define ROWS 3 #define COLS 3 void matrixMultiply(int *mat1, int *mat2, int *result, int rows1, int cols1, int cols2) {     int i, j, k;     // Multiplying matrices     for (i = 0; i < rows1; i++) {         for (j = 0; j < cols2; j++) {             *(result + i * cols2 + j) = 0;             for (k = 0; k < cols1; k++) {                 *(result + i * cols2 + j) += *(mat1 + i * cols1 + k) * *(mat2 + k * cols2 + j);             }         }     } } void displayMatrix(int *mat, int rows, int cols) {     int i, j;     // Displaying matrix     for (i = 0; i < rows; i++) {         for (j = 0; j < cols; j++) {             printf("%d\t", *(mat + i * cols + j));         }         printf("\n");     } } int main() {     int mat1[ROWS][COLS] = {{1, 2, 3},                             {4, 5, 6},                             {7, 8, 9}};     int mat2[ROWS][COLS] = {{9, 8, 7},                             {6, 5, 4},                             {

Write a C program (use a switch statement for selection) to add or subtract 2 matrices having order 3 x 3, depending upon the choice made by the user

Write a C program (use a switch statement for selection) to add or subtract 2 matrices having order 3 x 3, depending upon the choice made by the user. MCS-011 : PROBLEM SOLVING AND   PROGRAMMING (June, 2017) c program for matrix operations using switch case, c program for addition and subtraction of two matrices, algorithm for matrix addition in c program #include <stdio.h> #include<conio.h> void main() {     int first_matrix[3][3], second_matrix[3][3], sub_of_two_matrix[3][3],sum_of_two_matrix[3][3], i, j;      int oprater;      clrscr(); //Enter First Matrix      printf("\nEnter elements of 1st matrix:\n");     for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) {     printf("Enter element a%d%d: ", i + 1, j + 1);     scanf("%d", &first_matrix[i][j]); } //Enter Second Matrix      printf("Enter elements of 2nd matrix:\n");     for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) {     printf("Enter element

What is Compiler in C

What is Compiler Compile is a converting programming language into machine language.we are written a simple English language and computers do not understand the English language.  The  source file  written in the code human-readable ASCII text file (Source File).  The computer read 0 and 1 format. The compiler  human-readable code or text file, image file, and any file convert into machine language after the processing computer in this language. it got to have complied in machine language because computer read-only binary number format is 01010101. The compiler converts the   ASCII text file (Source File)  human-readable  into machine language. Compiler may be a software which converted program file into binary format in a single step. In simple words, the compiler may be a software which may take input from other language and converted into Low-Level Language (Machine Language) machine dependent language. Process of Translation You have written the program subsequent step is to save l
Write a C program to perform input/output of all basic data types. Write a C program to enter two numbers and find their sum. #include int main() { int num1, num2, sum; /* * Read two numbers from user */ printf("Enter first number: "); scanf("%d", &num1); printf("Enter second number:"); scanf("%d", &num2); /* Adding both number is simple and fundamental */ sum = num1 + num2; /* Prints the sum of two numbers */ printf("Sum of %d and %d = %d", num1, num2, sum); return 0; } Q. write calculator in c. #include #include int main(void) { float a,b; char sign; printf("Press 'q' to quit\n"); printf("Enter any number :"); scanf("%f",&a); do{ printf("Enter any operator :"); scanf("%s",&sign); printf("Enter any number :"); scanf("%f",&b); switch(sign){

BCA IGNOU

BCA 4th 1. BCS-040 Statistical Techniques Chick Me 2. MCS-024 Object Oriented Technologies and Java Programming Chick Me 3. BCS-041 Fundamentals of Computer Networks Chick Me 4. BCS-042 Introduction to Algorithm Design Chick Me 5. MCSL-016 Internet Concepts and Web Design Chick Me 6. BCSL-043 JAVA LAB Chick Me 7. BCSL-044 Statistical Techniques Lab Chick Me 8. BCSL-045 Algorithm Design Lab Chick Me

Bcsl-043 java sem4

Ignou question paper java java Java Solution BCSL 43 dec2016 solution Video BCSL 43 june2016 Solution Video BCSL 43 dec2015 Solution Video BCSL 43 june2015 Solution video BCSL 43 dec2014 Solution Video BCSL 43 june2014 Solution Video BCSL 43 dec2013 Solution Video BCSL43 june2013 Solution Video Dec2016  1.Write a Java program to create an applet to find the simple interest on a given amount, rate of interest and duration. Use proper GUI components in your program. import java.util.*; import java.awt.*; import java.awt.event.*; import java.applet.Applet; /* */ public class simpleinterest extends Applet{ Label l1,l2,l3,l4; TextField t1,t2,t3; Button b1; Image picture; public void init(){ picture = getImage(getCodeBase(),"20160613_091125.jpg"); l1=new Label("Enter the Amount "); l2=new Label("Enter the Rate "); l3=new Label("Enter interest Duration :"); l4=new Label(&

Contact Form

Name

Email *

Message *