C Program example: Simple Array program
| Previous | Home | Next |
#include<stdio.h>
#include<conio.h>
void main()
{
int a[] = {20, 30, 50, 70, 100};
int n, sum=0;
for ( n=0 ; n<5 ; n++ )
{
sum += a[n];
}
printf ("%d", sum);
return 0;
}
Output:270
| Previous | Home | Next |