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)); ...

How to make Dynamic Slider in php

How to make Dynamic Slider in php <div class="slider-area"> <div id="slider"> <?php $sqlidata1="SELECT * FROM `add_slider` WHERE `is_active` ='1'"; $countquery1=mysqli_query($conn,$sqlidata1); $count=0; while($datafact1=mysqli_fetch_array($countquery1)){ $sliderimage1= $datafact1['slider_image']; $count=$count+1; ?> <img src="admin/sliderimage/<?php echo $sliderimage1;?>" alt="slider-img" title="#caption<?php echo $count; ?>" /> <?php } ?> </div> <?php $sqlislider="SELECT * FROM `add_slider` WHERE `is_active` ='1'"; $countslider=mysqli_query($conn,$sqlislider); $slidercount=0; while($dataslider=mysqli_fetch_array($countslider)){ $slider_title=$dataslider['slider_title']; $sl...

Write and explain the following types of functions with the help of an example program for each (i) Function with no arguments and no return value. (ii) Function with arguments and no return value

hello Write and explain the following types of functions with the help of an example program for each  (i) Function with no arguments and no return value. (ii) Function with arguments and no return value. ANS-    1:  Function with no arguments and no return value: OUTPUT               In this type the function has no arguments, it doesn't receive any data from the calling function. Similarly it doesn't return any value, the calling function doesn't receive any data from called function.  So there's no digital communication between calling function and called function. #include<stdio.h> #include<conio.h> void sum(); void main() {        clrscr();     sum();     getch(); } void sum() {     int a,b;     printf(”Enter any two numbers:”);     scanf("%d%d",&a,&b);     printf(”sum= %d”,a+b); } In this function no return and no argumen...

write a C program to swap the values of two variables Using pointers

Question :- Using pointers, write a C program to swap the values of two variables. #include <stdio.h> #include<conio.h>   void main() {    int first_value, second_value, *first_pointer, *second_pointer, temp;      printf("Enter the value of First Value and Second Value\n");    scanf("%d%d", &first_value, &second_value);      printf("Before Swapping\nfirst_value = %d\nsecond_value = %d\n", first_value, second_value);      first_pointer = &first_value;    second_pointer = &second_value;      temp = *second_pointer;    *second_pointer = *first_pointer;    *first_pointer = temp;      printf("After Swapping\nfirst_value = %d\nsecond_value = %d\n", first_value, second_value);      getch(); } write a C program to swap the values of two variables Using pointers  int first_value, second_value, *first_pointer, *second_poi...

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

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 writ...
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){ ...

Contact Form

Name

Email *

Message *