fork download
  1. // C Code
  2.  
  3. // Write Pseudocode statements to Declare 4 Integers. You can decide on the variables names of each of the integers.
  4.  
  5. // Then, still using Pseudocode, set the values for 3 of the integers to valid integer values of your choice. In pseudocode, set the value of the 4th integer to the sum of the other 3 integers. Finally, print the output of the summed integers.
  6.  
  7. // Next, take your pseudocode and convert it to C code and demonstrate it runs properly in an online C compiler such as ideone.com or codetwist.com.
  8.  
  9. // Be sure to include all of your pseudocode, all of your C code and the output of running your C code.
  10.  
  11. #include <stdio.h>
  12. int fun(int n)
  13. {
  14. if(n!=0)
  15. {
  16. return n - fun(n-5);
  17. }
  18. else{
  19. return n;
  20. }
  21. }
  22. int main()
  23. {
  24. int n = 10,z;
  25. z= fun(n);
  26. printf("%d",z);
  27. }
  28.  
Success #stdin #stdout 0s 5432KB
stdin
Standard input is empty
stdout
5