One Dimensional Array Demo
This tutorial aims to demonstrate the one dimensional arrays with a corresponding value of its element.
#include <stdio.h>
int main()
{
char schl[] = "WWW.CODE-DEVS.BLOGSPOT.COM";
int i;
for( i=0; i < 26; i++)
{
printf("Element [%d]: %c\n", i, schl[i] );
}
int a[30] = {2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32};
int b;
int x;
printf("Enter even number from [ 2 - 16 ]: ");
scanf("%d", &b);
for(x=0; x < b; x++)
{
printf("Element [%d]: %d\n", x+1, a[x]);
}
return 0;
}
OUTPUT
#include <stdio.h>
int main()
{
char schl[] = "WWW.CODE-DEVS.BLOGSPOT.COM";
int i;
for( i=0; i < 26; i++)
{
printf("Element [%d]: %c\n", i, schl[i] );
}
int a[30] = {2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32};
int b;
int x;
printf("Enter even number from [ 2 - 16 ]: ");
scanf("%d", &b);
for(x=0; x < b; x++)
{
printf("Element [%d]: %d\n", x+1, a[x]);
}
return 0;
}
OUTPUT
One Dimensional Array Demo
Reviewed by code-dev
on
12:00 AM
Rating:
No comments: