Write a program to open a file using fopen() C Program

Write a program to find GCD of two numbers

The Greatest Common Divisor (GCD) or Highest Common Factor (HCF) of two numbers is the largest number that divides both numbers exactly, without leaving any remainder. The formula used in Euclid’s Algorithm for finding the GCD is based on the idea that: GCD(x, y) = x if y = 0 Otherwise, GCD(x, y) = GCD(y, […]

program to find the largest of n numbers and its location in an array C Program

Write a program to print Fibonacci Series

The Fibonacci series is a sequence where each term is the sum of the two preceding ones, starting from 1 and 1. The sequence looks like this: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … In this program, we aim to generate and print the Fibonacci series up to a specified […]

program to find the largest of n numbers and its location in an array Uncategorized

C Program to Print the Alternate Elements in an Array

#include <stdio.h> // Include the standard input-output libraryint main() // Change void main() to int main(){int array[10]; // Declare an array of size 10int i; // Declare the loop variableprintf(“Enter the elements of the array:n”);// Loop to read 10 integers from user inputfor (i = 0; i < 10; i++) {scanf(“%d”, &array[i]); // Store each […]

C Program

Write a C program to find sum of two matrices

#include <stdio.h>void main() {float a[2][2], b[2][2], c[2][2]; // Declare three 2×2 matricesint i, j;printf(“Enter the elements of the 1st matrix:n”);// Reading the first matrixfor(i = 0; i < 2; i++)for(j = 0; j < 2; j++) {scanf(“%f”, &a[i][j]);}printf(“Enter the elements of the 2nd matrix:n”);// Reading the second matrixfor(i = 0; i < 2; i++)for(j = […]

c program C Program

C Program for multiplication of two matrices

#include <stdio.h>#define MAX 10 // Maximum size of the matricesvoid multiplyMatrices(int first[MAX][MAX], int second[MAX][MAX], int result[MAX][MAX], int rowFirst, int columnFirst, int rowSecond, int columnSecond);int main() {int first[MAX][MAX], second[MAX][MAX], result[MAX][MAX];int rowFirst, columnFirst, rowSecond, columnSecond;// Input for the first matrixprintf(“Enter rows and columns for first matrix: “);scanf(“%d %d”, &rowFirst, &columnFirst);printf(“Enter elements of the first matrix:n”);for (int i […]