Advertisement
Guest User

Simple C Example

a guest
Jan 28th, 2018
1,256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. // main function
  2. // declarations
  3. int i;
  4. double val = 2.5, res[10];
  5. // statements
  6. for(i = 0; i < 10; i++){
  7.     res[i] = operation(val, i);
  8.     val = res[i];
  9.     print(res[i]);
  10.     print('\n');
  11. }
  12. return;
  13. // functions
  14. double operation (double value, int i){    /* function declaration */
  15.     // declarations
  16.     double res;
  17.     // statements
  18.     res = value*i + i;
  19.     return res;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement