To accept 5 numbers from keyboard and print it

Write a program to accept 5 numbers from keyboard and print it.


Source code:

#include<stdio.h>
#include<conio.h>
void main()
{
	int a[5],i;
	clrscr();
	for(i=0;i<5;i++)
	{
		printf("Enter the array elements:");
		scanf("%d",&a[i]);
	}
	for(i=0;i<5;i++)
	{
		printf("array elements is:%d \n",a[i]);
	}
	getch();
}

Output:

Enter the array elements: 2
Enter the array elements: 3
Enter the array elements: 4
Enter the array elements: 5
Enter the array elements: 1

Array elements is: 2
Array elements is: 3
Array elements is: 4
Array elements is: 5
Array elements is: 1

Leave a Reply

Your email address will not be published. Required fields are marked *