-->
Showing posts with label inputting elements in an array;displaying elements stored in an array. Show all posts
Showing posts with label inputting elements in an array;displaying elements stored in an array. Show all posts

program to enter any four elements and display that.

 //program to enter any four elements and display that.
#include<stdio.h>
#include<conio.h>
void main()
{
float arr[20],k;                                                                        // array declaration with maximum limit 20
float n,size;                                                                                  // says about size of array to be entered

printf("enter size of array\n");
scanf("%f",&size);
for(k=0;k<size;k++)
{
   printf("enter element for location=%d\n",k);                           // for elements in particular location
   scanf("%f",&arr[k]);
}
printf("elements are\n");
for(k=0;k<size;k++)
{
   printf(" element for location=%d is\n",k);                               // for elements in particular location
   printf("%f",arr[k]);
}

getch();
}