PSP(EX6_8)
PSP(EX6_8)
return 0;
}
2.Product of two matrix.
#include <stdio.h>
int main () {
int m = 2, n = 2; // Dimensions for 2x2 matrices
int i, j, k;
int a [2][2], b [2][2], product [2][2];
return 0;
}
Ex 7:
1. WACP to ill urate four function of string.
#include <stdio.h>
#include <string.h>
int main () {
char str1[50], str2[50], str3[100];
int length, comparison;
return 0;
}
2. Write a c program to display fibonacci series using recursion
#include <stdio.h>
// Function to calculate Fibonacci numbers using recursion
int fibonacci(int n) {
if (n == 0)
return 0; // Base case: 0th Fibonacci number
else if (n == 1)
return 1; // Base case: 1st Fibonacci number
else
return fibonacci(n - 1) + fibonacci(n - 2); // Recursive case
}
int main() {
int n, i;
printf("\n");
return 0;
}
Ex8:
1. WACP to illustrate nested structures.
#include <stdio.h>
#include <string.h>
struct Person {
char name[50];
int age;
struct Address; // Nested structure
};
int main() {
struct Person;
return 0;
}
2. WACP by defining a structure called Student and define members like id, name and
age and define two variables s1,s2 and display the values of all the
members using s1,s2.
#include <stdio.h>
#include <string.h>
int main() {
struct Student s1, s2;
return 0;
}