Advertisement
Mazamin

01_10_1.1

Oct 2nd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. /*
  2.  * File:   main.c
  3.  * Author: Gerardo Cicalese
  4.  *
  5.  * Created on 16 settembre 2019, 15.48
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. int sumvex(int * vex, int n){
  12.     return (n==1)?(*vex):(vex[n-1]+sumvex(vex, n-1));
  13. }
  14.  
  15. int main(void){
  16.     int min, vex[]={63, 15, 42, 63, 92, 34, 77, 23, 78, 37, 26, 7, 79, 85, 82, 19, 89, 10, 64};
  17.     size_t len=sizeof(vex)/sizeof(vex[0]);
  18.     printf("Sum is %d\n", sumvex(vex, len));
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement