Friday, March 8, 2013

C Language Example # 33 Sum of two array into third array.

C Language Example # 33 Sum of two array into third array.


* Program will sum two array to third one.

//Written by Latest Technology Guide    
//Title : C Language Example # 
33 Sum of two array into third array.


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

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

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

printf("\n\t\t : Sum of A + B is Stored in C : ");
printf("\n\t\t\t : See All C element :");

for(i=0;i<5;i++)
printf("\nc[%d] = %d",i,c[i]);


getch();
}

Output:

* Program will sum two array values into third array.

* Output will be as per third array value. summation of two array.
--------------------------------------------------------------------------------
Explanation of C Programming Language Example # 33 Sum of two array into third array.


* Program will create static array.
* Program will scan value from users and will store into array.
* Program will prepare sum of two array into third one.


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. 

No comments:

Post a Comment