Skip to main content

Posts

Showing posts with the label BCA IGNOU

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

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]); } }

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

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

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

Contact Form

Name

Email *

Message *