Skip to main content

Posts

Showing posts from July, 2021

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 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

 

make a calculator in c or write a code calculator

 #include<stdio.h> #include<conio.h> 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){ case'+': a=a+b; printf("Result :%.2Lf\n",a); break; case'-': a=a-b; printf("Result :%.2f\n",a); break; case'*': a=a*b; printf("Result :%.2f\n",a); break; case'/': a=a/b; printf("Result :%.2f\n",a); break; case'%': a=(b*a)/100; printf("Result :%.2f\n",a); break; default: printf("Invalid Operator\n"); } } while(sign!='q'); printf(

Write a program Ascending Order in c language

 //Ascending Order #include<Stdio.h> #include<conio.h> int main(void){ int a[10],b,c,n,i,j; printf("Enter number of elements :"); scanf("%d",&n); for(i=1; i<=n; i++){ printf("Enter any number :"); scanf("%d",&a[i]); } for(i=1; i<=n; i++){ for(j=i+1; j<=n; j++){ if(a[i]>a[j]){ b=a[i]; a[i]=a[j]; a[j]=b; } } } printf("Ascending Order :\n"); for(i=1; i<=n; i++){ printf("%d\t",a[i]); } }

Contact Form

Name

Email *

Message *