- 2
Input :- [1,3,5] Output :- 9 ________________________ Input :- [4,5,6,7,8,9] Output:- 9 _________________________ Input :-
Create a function that returns the sum of array elements where array is given as a input except for the elements after integer 6 till 9
5 ответов
+ 1
If you need help then send your try and you'll get help.
This place is to help not replace you
+ 1
Please show us your attempt first.
+ 1
Do you want to print sum of the array as "9" only
please explain in details .
input should from 0 to 5 only
you have not specify the array size
0
It should not take elements from 6 to 9
- 2
int a[3],i=0,num=0,sum=0;
Printf(" eneter any 3 number ");
while(1){
scanf("%d",&num);
if(num>0 && num<6){
a[i]=num;
i++;
}
If( i>2) break;
}
for(int j=0;j<3j++){
sum= sum +a[j];
}