C Program to calculate Addition of All Elements in Array.

    

     

#include <stdio.h>


int main()

{  int i,sum=0;

    int arr[5],size;

    printf("enter the array size ");

    scanf("%d",&size);

    printf("enter the %d value from array \n",size);

    for(i=0;i<size;i++){

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

    

    

           sum=sum+arr[i];

    }

           printf("the sum of array is  %d \n",sum);

    

    return 0;

}


No comments:

Post a Comment

Programming in C Language

  PROGRAM LIST TO BECOME PRO IN C    😍😍😍            PRACTICE SETS                                                        UNIT -1  👇   IN...