Tuesday, June 25, 2019

array test 3 in c language

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i=0,sum=0,arr[6]={4,2,6,0,5,10};
     printf ("arr[0]=%d\n",arr[0]);
    while(arr[i])
    {
        sum=sum+arr[i] ;
            i++;
    }
    printf("sum=%d\n",sum) ;

    return 0;
}




No comments:

Post a Comment

python class topic video