Program

#include<stdio.h>
int main()
{
    int a[5],i,sum=0;
    for(i=0;i<5;i++)
    {
        printf("Enter number %d:",i+1);
        scanf("%d",&a[i]);
        sum=sum+a[i];
    }
    printf("Sum=%d",sum);
    return 0;
}

Output

Enter number 1: 10
Enter number 2: 30
Enter number 3: 20
Enter number 4: 50
Enter number 5: 40
Sum = 150

Leave a Reply

Your email address will not be published. Required fields are marked *