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

how to add n number of element of array

how to add n number  of element of array   how to  Addition the elements of array #include<stdio.h> #include<conio.h> int main(void){ int a[10],b,i,sum; printf("Enter number of elements to add :"); scanf("%d",&b); sum=0; for(i=1; i<=b; i++){ printf("Enter values :"); scanf("%d",&a[i]); sum=sum+a[i]; } printf("Result :%d",sum); getch(); }

what is programming language

 what is programming language You must appreciate the fact that programming languages ​​are created by us humans. These languages ​​are used to communicate instructions to machines, especially computers, so that programs can control the behavior of the machines' hardware to achieve the desired results.  Basically, the hardware of the computer understands only the language of the hardware which is called as machine language. The hardware is unable to understand and understand a program written in another programming language. In addition, each type of CPU has its own machine language. Therefore, in order for the computer's hardware to understand the instructions contained in a program written in another programming language, a mechanism is needed, called a 'translator'. It converts programs written in programming languages ​​other than the native machine language of the CPU (hardware) into the native machine language of a particular CPU on which this program is intended

write a program in java swaping two numbers

 write a program in java swaping two numbers  import java.util.*; class sw{ int a,b,temp; void swap(){ Scanner in=new Scanner( System.in); System.out.println("enter the first value:"); a=in.nextInt(); System.out.println("enter the second value:"); b=in.nextInt(); temp=a; a=b; b=temp; System.out.println(+"a= "+a+"b="+b); } } class swap{ public static void main(String args[]){ sw pic=new sw(); pic.swap(); } }

Odd and Even number by java

Odd and Even number by java  import java.util.*; class eo{ int num; void evod(){ Scanner in=new Scanner( System.in); System.out.println("enter the  value:"); num=in.nextInt(); if(num%2==0){ System.out.println("output value even:"+num); } else{ System.out.println("output value odd:"+num); } } } class evenodd{ public static void main(String args[]){ eo pic=new eo(); pic.evod(); } }

Sum of Two number java applet

S um of Two number java applet /* <applet code="sumOf2No" height=150 width =350>   </applet> */ import java.awt.*; import java.applet.*; publicclass sumOf2No extends Applet {      TextField T1,T2;      publicvoid init() {          T1 = new TextField(10);          T2 = new TextField(10);          add(T1);          add(T2);          T1.setText("0");          T2.setText("0");       }       publicvoid paint(Graphics g) {            int a, b, result;            String str;            g.drawString("Enter Number in TextField to Find addition of 2 No ",10,50);            g.setColor(Color.red);            str=T1.getText();            a=Integer.parseInt(str);            str=T2.getText();            b=Integer.parseInt(str);            result=a+b;            g.drawString("After Addition the Result is : "+result,10,80);            showStatus("Addition of 2 Numbers");         } public boolean action(Event e, Object o){          

internet and web designing mdu question paper or msc question paper

 

java mdu question paper

 

Contact Form

Name

Email *

Message *