- This topic has 0 replies, 1 voice, and was last updated 19 years, 8 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › Insert elements in an array
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <br /> #include<stdio.h><br /> #include<conio.h><br /> #include<iostream.h>void main(){<br /> int a[10];<br /> int i,n,j,item,m;<br /> clrscr();<br /> textmode(3);<br /> printf("Enter an array of Ten Elementsn");<br /> for ( i=1;i<=10;i++)<br /> scanf("%d",&a);<br /> printf("The array you enterd wasn");<br /> for (i=1;i<=10;i++)<br /> printf("n%d",a);<br /> printf("nEnter Element an element to insert in the arrayn");<br /> scanf("%d",&item );<br /> printf("nEnter Location (1--10) to insert this elementn");<br /> scanf("%d",&m) ;<br /> a[m]=item;<br /> printf("nThe number wasn%d ",item);<br /> printf("nLocation wasn%d ",m);<br /> printf("nUpdated array isn");<br /> for (i=1;i<=10;i++)<br /> printf("%dn ",a);<br /> getch();<br /> }<br /> |