Insert array

C program to input array from user :

code

 

#include<stdio.h>
#include<conio.h>
void main()
{
int arry[20],i,size;

clrscr();
printf(“Enter size of an array :”);
scanf(“%d”,&size);
for(i=0;i<size;i++)
{
printf(“\nEnter element at %d location:”,i);
scanf(“%d”,&arry[i]);
}
printf(“\n entered array element :”);

for(i=0;i<size;i++)
{
printf(“\n%d”,arry[i]);
}

getch();
}

 


output

Enter size of an array :

5

Enter element at o location :23

Enter element at 1 location :10

Enter element at 2 location :34

Enter element at 3 location :99

Enter element at 4 location :55

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s