Skip to main content

Posts

Showing posts from October, 2022

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},                             {

27 October History: The world got sewing machine on this day, India gave 'Agni test' for missile power

  Trending News: 27 अक्टूबर को इतिहास के चश्मे से देखें तो यह दिन कई मायनों में खास है. एकतरफ दुनिया को जहां आज ही के दिन मशीन जैसी चीज मिली थी तो भारत ने अग्नि-5 मिसाइल का परीक्षण भी आज ही किया था. Trending News: If you look at the prism of history on October 27, then this day is special in many ways. On one hand, where the world got a machine-like thing on this day, India had also tested Agni-5 missile today. 27 अक्टूबर ऐतिहासिक घटनाएँ: अक्टूबर का महीना खत्म होने की कगार पर है और नवंबर दस्तक देने वाला है। अक्टूबर आमतौर पर कई त्योहारों का गवाह बनता है, लेकिन इतिहास के नजरिए से देखा जाए तो यह महीना कई मायनों में खास है। अगर 27 अक्टूबर की बात करें तो इस दिन के अंदर भी कई इतिहास हैं। आइए जानते हैं कुछ ऐसे ही अहम पलों के बारे में जो आस से जुड़े हैं। 27 October Historical Events: The month of October is on the verge of ending and November is about to knock. October usually witnesses many festivals, but even if seen through the prism of history, this month is special in many ways. If we ta

Here you get a leave from the office to have a physical relationship, know why the government has made this unique rule

Here you get a leave from the office to have a physical relationship, know why the government has made this unique rule   There is an official holiday for having a physical relationship, are you surprised to read the headline? But this is true. There is a country where people get leave to have physical relationship. Let us tell about that country and what is the reason behind it. Relationship Desk . The meeting of two hearts or the establishment of a physical relationship between them is a moment. Why would a leave be given for this? But you will find it strange to know that there is a country where the government has made a provision of leave for this. People get leave from office to have sex. The name of that country is Denmark. Yes, this facility has been given to the people in this country. Actually, the decreasing population of Denmark has been a matter of concern for the government there. From time to time, the government there runs such campaigns. Due to which people get the fee

what is Algorithm || how to write Algorithm || Algorithm kaise likhte hai

 Criteria to be followed by an Algorithm The following is the criteria to be followed by an algorithm :  • Input : There should be zero or more values which are to be supplied.  • Output : At least one result is to be produced.  • Definiteness : Each step must be clear and unambiguous.  • Finiteness : If we trace the steps of an algorithm, then for all cases, the algorithm must terminate after a finite number of steps.  • Effectiveness : Each step must be sufficiently basic that a person using only paper and pencil can in principle carry it out. In addition, not only each step is definite, it must also be feasible Example  Let us try to develop an algorithm to compute and display the sum of two numbers  1. Start  2. Read two numbers a and b  3. Calculate the sum of a and b and store it in sum  4. Display the value of sum  5. Stop   #include<stdio.h> #include<conio.h> void main(){ int a,b,sum; printf("Enter Any Two Number : "); scanf("%d%d",&a,&b)

Contact Form

Name

Email *

Message *