fork download
  1. // C code
  2. // This program will provide options for a user to calculate the square
  3. // or cube of a positive Integer input by a user.
  4. // Developer: Jose Briscoe CMIS102
  5. // Date: February 25, 2017
  6.  
  7. #include <stdio.h>
  8.  
  9. // Function prototypes
  10. int Shrink(int value);
  11.  
  12.  
  13. int main ()
  14. {
  15. /* variable definition: */
  16. int intValue;
  17. double Results;
  18. intValue = 1;
  19.  
  20. // While a positive number
  21.  
  22. Do {
  23. printf ("Enter a positive Integer\n: ");
  24. scanf("%d", &intValue);
  25. }
  26.  
  27. while (intValue > 0);
  28.  
  29.  
  30. if (intValue > 0)
  31. {
  32. // Call the Shrink Function
  33. Results = Shrink(intValue);
  34. printf("integer %d divided by 2 is %.2f\n",intValue,Results);
  35.  
  36. } //Close If
  37.  
  38. else
  39. printf("Only will divide by positive integers\n");
  40.  
  41. return 0;
  42.  
  43. } // Close While
  44.  
  45.  
  46.  
  47. } //Close Main
  48.  
  49.  
  50. /* function that would take an Integer and return the Integer divided by 2 */
  51. int Shrink(int value)
  52. {
  53. return value/2;
  54. }
  55.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
9
8
-24
compilation info
prog.c: In function ‘main’:
prog.c:22:1: error: ‘Do’ undeclared (first use in this function)
 Do {
 ^~
prog.c:22:1: note: each undeclared identifier is reported only once for each function it appears in
prog.c:22:4: error: expected ‘;’ before ‘{’ token
 Do {
    ^
prog.c: At top level:
prog.c:47:1: error: expected identifier or ‘(’ before ‘}’ token
 } //Close Main
 ^
stdout
Standard output is empty