Testing.

Sunday, 5 February 2017

C programming language: First Array program in c.


#include<stdio.h>
#include<conio.h>
void main()
{
int arr[5]={10,20,30,40,50};
printf("\nArray Elements Are: ");
printf("\n %d",arr[0]);
printf("\t %d",arr[1]);
printf("\t %d",arr[2]);
printf("\t %d",arr[3]);
printf("\t %d",arr[4]);
getch();
}

----------------------------------------------------------------------------------------------------------------
First Array program.
----------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[5];
arr[0]=10;
        arr[1]=20;
arr[2]=30;
arr[3]=40;
arr[4]=50;
printf("\nArray Elements Are: ");
printf("\n %d",arr[0]);
printf("\t %d",arr[1]);
printf("\t %d",arr[2]);
printf("\t %d",arr[3]);
printf("\t %d",arr[4]);
getch();
}

----------------------------------------------------------------------------------------------------------------
First Array program.
----------------------------------------------------------------------------------------------------------------#include<stdio.h>
#include<conio.h>
     void main()
     {
       int arr[5],i;
printf("\nEnter Array Elements: ");
for(i=0;i<5;i++)
scanf("%d",&arr[i]);

printf("\nArray Elements Are: ");
for(i=0;i<5;i++)
printf(" %d",arr[i]);
getch();
     }

No comments:

Post a Comment