C program to find sum of numbers of an array

Simple C program to find sum of numbers of an array

Code:

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int a[50];

int l,i;

int sum=0;

printf("\n enter length of array:");

scanf("%d",&l);

printf("\n enter array:");

for(i=0;i<l;i++)

{

scanf("%d",&a[i]);

sum+=a[i];

}

printf("\nsum of array elements is:%d",sum);

getch();

}

Comments

Popular posts from this blog

C program to evaluate Prefix Expression using Stack data structure

Servlet Program to Print Today’s Date and Time using refresh header

Java Program to Implement sorting algorithm using TCP on Server application