Tuesday, 21 July 2015

Write a C Program To Find Summation And Multiplication Of Inputed Array Elements

Write a C Program To Find Summation And Multiplication Of Inputed Array Elements
 
#include<stdio.h>
#include<conio.h>

void main()
{
    int i,no[5],n,sum,mul;

    clrscr();
    sum=0;
    mul=1;
    printf("Enter n:");
    scanf("%d",&n);

    for(i=0;i<n;i++)
    {
        printf("\nEnter No[%d]:",i);
        scanf("%d",&no[i]);
    }
    for(i=0;i<n;i++)
    {
    sum=sum+no[i];
    mul=mul*no[i];
    printf("\nValue of No[%d]:%d",i,no[i]);
    }
    printf("\nSum : %d",sum);
    printf("\n Multiplication =%d",mul);
    getch();
}

No comments:

Post a Comment