C Program to Initialize an Array and Print it

Write C Program to Initialize an Array and Print it

// C Program to Initialize an Array and Print it

#include <stdio.h>

int main()
{
	int A[] = {1, 2, 3, 4, 5}, i, j;

	int B[5];
	B[0] = 88;
	B[1] = 77;
	B[2] = 99;
	B[3] = 55;
	B[4] = 66;

	printf("Elements of Array A :--> ");
	for(i = 0; i < 5; i++)
	{
		printf("%d  ", A[i]);
	}

	printf("\n");
	printf("Elements of Array B :--> ");
	for(i = 0; i < 5; i++)
	{
		printf("%d  ", B[i]);
	}
	return 0;
}

Output:

Elements of Array A :--> 1  2  3  4  5
Elements of Array B :--> 88  77  99  55  66

≪ Previous | Next ≫