• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Sql
  • php
  • C program
  • Seo

Codelack.com

  • Home
  • C++
  • networking
  • Sql server
    • what is rdbms | one to one | one to many | many to many relation-codlack
    • sql server create table
    • code rules in sql server
  • ASP.NET
    • control state in asp.net
    • cookie in asp.net
    • datalist control in asp .net
    • Using ASP.NET To Send Email
    • application state in asp.net
    • file upload control in asp.net
  • contact us
  • Data structure
    • what is Data structure
    • doubly linked list program in c
    • Array in data structure
    • circular queue in data structure
    • Linear data structure
    • Delete node at any position in singly linked list
    • dequeue in data structure
    • implementation of stack using a Linked list in data structure
    • implementation of stack using array in data structure
    • linked list algorithm
    • linked list in data structure
  • C
    • continue and break in c
    • history of c programming language
    • array program in c
    • c programming practice questions
    • enumeration in c
    • C programs with solutions
    • Characteristic of c
    • print 1 to 100 without using loop in c program
    • two single dimension 2D array in c
  • php
    • php
    • Variables in PHP
    • Scalar data types in php
    • Output function in php
    • how to use php string functions | example of string function
    • point to point configuration
    • error in php
    • Array in  php

array multiplication

array program in c

November 25, 2017 by admin Leave a Comment

/*writer array  program in c  to accept elements in two single dimension 2D array  and add them into third array */

 

# include<stdio.h>
main()
{
	int arr1[5], arr2[5], arr3[5];
	int i=0;
	printf("\n Enter elements for first array");
	for(i=0;i<=4;i++)         // First for loop to accept first array elements.
	{
		printf("\nEnter number:");
		scanf("%d",&arr1[i]);
	}
	printf("\n Enter elements for second array");
	for(i=0;i<=4;i++)    	// Second for loop to accept second array elements
	{
		printf("\nEnter number:");
		scanf("%d",&arr2[i]);
	}
	printf("\n addition stored in third array");
	for(i=0;i<=4;i++)      // Third for loop to add elements of array into third.
	{
		arr3[i]=arr1[i]+arr2[i];  // Putting added elements of arr1 and arr2 into arr3 at ith location.
		printf("\n arr3[%d]=%d ",i, arr3[i]);
	}
	getch();
}

 

write a array program in c to add and subtract two 3X3 matrices

# include<stdio.h>
main()
{
	int arr1[3][3], arr2[3][3];
	int arradd[3][3], arrsub[3][3];
	int i=0,j=0;
	clrscr();
	printf("\n Enter elements of first array\n");
	for(i=0;i<=1;i++)
	{
		printf("\n");
		for(j=0;j<=2;j++)
		{
			printf("Enter arr[%d][%d]:\t", i,j);
			scanf("%d", &arr1[i][j]); // Accepting array elements for first array arr1.
		}
	}
	printf("\n Enter elements of second array\n");
	for(i=0;i<=2;i++)
	{
		printf("\n");
		for(j=0;j<=2;j++)	 	// Accepting array elements for second array arr2.
		{
			printf("Enter arr[%d][%d]:\t", i,j);
			scanf("%d", &arr2[i][j]);
		}
	}
	for(i=0;i<=2;i++)
	{
		for(j=0;j<=2;j++)
		{
			arradd[i][j]=arr1[i][j]+arr2[i][j];	

			arrsub[i][j]=arr1[i][j]-arr2[i][j];	
		}
	}
	printf("\n Addition of two matrices\n\n");
	for(i=0;i<=2;i++)
	{
		for(j=0;j<=2;j++)
		{
			printf("arradd[%d[%d]=%d\t", i, j, arradd[i][j]); 	
		}
		printf("\n");
	}
	printf("\n Subtraction of two matrices\n\n");     
	for(i=0;i<=2;i++)
	{
		for(j=0;j<=2;j++)
		{
			printf("arradd[%d[%d]=%d\t",i,j,arrsub[i][j]);   	
		}
		printf("\n");
	}
	getch();
}

 

Filed Under: array multiplication, C program

Primary Sidebar

sql

  • introduction of sql
  • database management system
  • hierarchical database management system
  • what is rdbms | one to one | one to many | many to many relation-codlack
  • codd rules in sql server
  • Character Data Type
  • constraint unique
  • sql server create table

data structure

  • Data structure
  • Linear data structure
  • Array in data structure
  • What is a algorithm
  • stacks in data structure
  • queue data structure
  • dequeue in data structure
  • Priority queue
  • circular queue in data structure
  • linked list algorithm
  • Delete node in singly linked list
  • tree in data structure
  • implementation of stack using array in data structure
  • implementation of stack using a Linked list in data structure
  • Doubly Linked List Implementation

C programming

  • history of c programming language
  • C programs with solutions
  • Characteristic
  • constraint unique
  • continue and break
  • doubly linked list program in c
  • dynamic memory allocation
  • enumeration
  • print 1 to 100 without using loop
  • Variable declaration

c++

  • Introduction to C++ || similarities of  C++ structure and  class
  • default argument in c++
  • access specifiers in c++
  • Function In C++
  • friend function in c++
  • constructor in c++
  • destructor in c++ | How to call destructor C++
  • exception handling in c++

Categories

array multiplication (1) asp.net (10) B.ed (1) C# (1) c# (1) C++ (2) C program (3) FormView control (1) php (2) Seo (5) Sql (1) Uncategorized (10)
disclaimer

Copyright © 2022 · codelack.com