Tuesday, 4 February 2014

Write a ‘C’ program to insert n integer in an array and display them.

#include<stdio.h>

main()
{
    int a[100],n,i;
    printf("\nEnter number of terms=");
    scanf("%d",&n);
    printf("\nEnter the integers=");
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
   
    printf("\nThe array elements are=");
    for(i=0;i<n;i++)
    {
        printf("%d ",a[i]);
    }
}

No comments:

Post a Comment