Friday, March 15, 2013

C Language Example # 38 Simple Array Multiplication

C Language Example # 38 Simple Array Multiplication.

* Program will simply multiply array elements into another one.
* This program is not a matrix multiplication, This program will simply multiply the array elements.

//Written by : Latest Technology Guide
//Title : C Language Example # 38 Simple Array Multiplication.



#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int a[5]={0},b[5]={0},c[5]={0},i;
float d[5]={0};

printf("\n Now Enter Value for Array A : \n");

for(i=0;i<5;i++)
{
printf("a[%d] = ",i);
scanf("%d",&a[i]);
}

printf("\n Now Enter Value for Array B : \n");

for(i=0;i<5;i++)
{
printf("b[%d] = ",i);
scanf("%d",&b[i]);
}

printf("\n Now Enter Value for Array C : \n");

for(i=0;i<5;i++)
{
printf("c[%d] = ",i);
scanf("%d",&c[i]);
}


for(i=0;i<5;i++)
d[i]=a[i]*b[i]*c[i];

printf("\n\t : Multiplication of A * B  * C is Stored in D : ");
printf("\n\t\t\t : See All D element :");

for(i=0;i<5;i++)
printf("\nd[%d] = %5.2f",i,d[i]);


getch();
}


Output:





--------------------------------------------------------------------------------
Explanation of C Programming Language Example # 38 Simple Array Multiplication.

* You need to enter array values into 3 array for multiplication.
* Then program will multiply 3 array value into 3rd one.
* Don't confuse with matrix multiplication, this program is not for matrix multiplication.
* This program is not for row column multiplication.


Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements. 

1 comment:

  1. thank you for sharing nice article in your blog
    visit
    web tutorial programming
    https://www.welookups.com

    ReplyDelete