This program is about insert and print the element in an array using array
#include<stdio.h> int main() { int i,t,a[10],n,m,s,j=0,b[10]; printf("\nEnter the limit:"); scanf("%d",&n); printf("\nEnter the values:"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("\nGiven values are:"); for(i=0;i<n;i++) { printf("\na[%d]=%d",i,a[i]); } printf("\nEnter the position to be changed:"); scanf("%d",&t); printf("\nEnter the value to be changed:"); scanf("%d",&s); for(i=0;i<t;i++) { b[j]=a[i]; j++; } b[j]=s; j++; for(i=t;i<n;i++) { b[j]=a[i]; j++; } printf("\nInserted value is:"); for(i=0;i<=n;i++) { printf("\na[%d]=%d",i,b[i]); } return 0; }To download raw file Click Here
Enter the limit:5 Enter the values:1 2 3 4 5 Given values are: a[0]=1 a[1]=2 a[2]=3 a[3]=4 a[4]=5 Enter the position to be changed:3 Enter the value to be changed:5 Inserted value is: a[0]=1 a[1]=2 a[2]=3 a[3]=5 a[4]=4 a[5]=5
Learn All in Tamil © Designed & Developed By Tutor Joes