Write a program to store 5 elements in the array P and 3 elements in the array Q.Produce a third array R after joining the array P and Q.Display the resultant array.

program to store 5 elements in the array P and 3 elements in the array Q.

  • Sree
  • 30 जुलाई
  • 4561 दृश्य
  • 1 उत्तर
Your Answer

#include<stdio.h>
#include<conio.h>
void main()
{
 int p[5],q[3],r[8],i,j;
clrscr();
printf("enter the elements of an array P-\n");
for(i=0;i<5;i++)
scanf("%d",&p[i]);
printf("enter the elements of an array Q-\n");
for(i=0;i<5;i++)
scanf("%d",&q[i]);
printf("After joining P and Q..............-\n");
for(i=0;i<5;i++)
r[i]=p[i];
for(j=0;j<3;j++)
{
 r[i]=q[j];
i++;
}
printf("Total elements of an array R-\n");
for(i=0;i<8;i++)
printf("%d\n",r[i]);
getch();
}
 

0
c programming
मॉक परीक्षण अभ्यास के लिए
c programming