Don Bosco Institute of Technology Department of Basic Science and Humanities 2021-2022 C Programming Lab
Don Bosco Institute of Technology Department of Basic Science and Humanities 2021-2022 C Programming Lab
start
false
i<10
true
sum=sum+a[i] stop
int main()
{
int i=0 ,sum =0 ,a[10];
printf("enter 10 numbers\n");
for(i=0;i<10;i++){
scanf("%d",&a[i]);
sum = sum + a[i];
}
printf("\n Number stored in array\n");
for(i=0;i<10;i++){
printf("a[%d] = %d\n",i,a[i]);
return 0;
}
Output enter 10 numbers
1
2
3
4
5
6
7
8
9
0
the sum is 45
Conclusion An array along with for loop is used in order to calculate sum of 10 numbers
In the above experiment we learned about array indexing and representation