Showing posts with label Program to add 5 no.s using array. Show all posts
Showing posts with label Program to add 5 no.s using array. Show all posts

Wednesday, July 20, 2011

Program to add 5 numbers using array.

/*Serial No.44     [swami15.cpp]*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,arr[5],sum=0;
clrscr();
for(i=0;i<5;i++)
{
printf("Enter the %d number==>",i+1);
scanf("%d",&arr[i]);
}
for(i=0;i<5;i++)
{
sum=sum+arr[i];
}
printf("\nSum of the array is==>%d",sum);
getch();
}