- 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

4th May 2020, 5:34 AM
Vrushabh Kupwade
5 Antworten
+ 1
If you need help then send your try and you'll get help. This place is to help not replace you
4th May 2020, 5:36 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
+ 1
Please show us your attempt first.
4th May 2020, 5:36 AM
XXX
XXX - avatar
+ 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
4th May 2020, 5:41 AM
Dasarath Singh
0
It should not take elements from 6 to 9
4th May 2020, 5:46 AM
Vrushabh Kupwade
- 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]; }
4th May 2020, 6:09 AM
Dasarath Singh