fork download
  1. #include <stdio.h>
  2. //Function prototypes
  3. double SuperShrink(double value);
  4. double Shrink(double value)
  5. int Square(int value);
  6. int Cube(int value);
  7. int main ()
  8. {
  9. /* variable definition: */
  10. int intValue, menuSelect,Results;
  11. double dblValue,db1Results;
  12. intValue = 1;
  13. // While a positive number
  14. while (intValue > 0)
  15. {
  16. printf ("Enter a positive Integer\n: ");
  17. scanf("%d", &intValue);
  18. if(intValue>0)
  19. {
  20. print (Enter a positive Interger\n:");
  21. scanf("%d",&intValue);
  22. if(intValue>0)
  23. {
  24. db1Value=intValue;
  25. printf ("Enter 1 to calculate Square, 2 to Calculate Cube ,3 to Shrink, 4 to supershrink\n: ");
  26. scanf("%d", &menuSelect);
  27. if (menuSelect == 1)
  28. {
  29. // Call the Square Function
  30. Results = Square(intValue);
  31. printf("Square of %d is %d\n",intValue,Results);
  32. }
  33. else if (menuSelect == 2)
  34. {
  35. // Call the Cube function
  36. Results = Cube(intValue);
  37. printf("Cube of %d is %d\n",intValue,Results);
  38. }
  39. else if (menuSelect == 3)
  40. {
  41. // Call the Shrink function
  42. db1Results = Shrink(db1Value);
  43. printf("Shrink of %d is %f\n",intValue,db1Results);
  44. }
  45. else (menuSelect=4)
  46. {
  47. //Call the Shrink function
  48. db1Results = SuperShrink(db1Value);
  49. printf("SuperShrink of %d is %f\n",intValue,db1Results);
  50. }
  51. else
  52. printf("Invalid menu item, only 1, 2 or 3 is accepted\n");
  53. }
  54. }
  55. return 0;
  56. }
  57. /* function returning the Square of a number */
  58. int Square(int value)
  59. { return value*value;
  60. }
  61. /* function returning the Cube of a number */
  62. int Cube(int value)
  63. { return value*value*value;
  64. }
  65. //function returning the Shrink of a number
  66. double shrink (double value)
  67. {
  68. return value/2;
  69. }
  70. //function returning the Shrink of a number
  71. double Supershrink (double value)
  72. { return value/4;
  73. }
  74.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
88
3
44
3
11
-99
compilation info
prog.c: In function ‘Shrink’:
prog.c:8:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
prog.c:20:33: error: stray ‘\’ in program
 print (Enter a positive Interger\n:");
                                 ^
prog.c:20:36: warning: missing terminating " character
 print (Enter a positive Interger\n:");
                                    ^
prog.c:20:36: error: missing terminating " character
 print (Enter a positive Interger\n:");
                                    ^~~
prog.c:4:8: error: old-style parameter declarations in prototyped function definition
 double Shrink(double value)
        ^~~~~~
prog.c:73:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
stdout
Standard output is empty