fork download
  1. // C code
  2.  
  3. // This program will count to a number to user inputs if positive
  4. //If negative it will count to zero from the number inputted by user
  5.  
  6. // Developer: Kurtis Barnett
  7.  
  8. // Date: Sep 24, 2017
  9.  
  10. #include <stdio.h>
  11.  
  12. int main (void)
  13.  
  14. {
  15.  
  16. /* variable definition: */
  17.  
  18. int EndNum,CurrentNum;
  19.  
  20.  
  21.  
  22. /* Initialize */
  23.  
  24.  
  25. printf("Enter A positive whole number you want to count to.\n");
  26. printf("OR\n");
  27. printf("A negative whole number that you want to count to zero with.\n");
  28.  
  29. scanf("%d", &EndNum);
  30. // Loop through to input values
  31. if (EndNum = str)
  32. if (EndNum > 0) {
  33. while(EndNum>CurrentNum){
  34. CurrentNum = 1 + CurrentNum;
  35. printf("%d",CurrentNum);
  36. printf(" ");
  37. }
  38. printf("!\n");
  39. printf("You can now count to ");
  40. printf("%d",EndNum);
  41. }
  42.  
  43. else {
  44. CurrentNum=EndNum;
  45. printf("%d",CurrentNum);
  46. printf(" ");
  47.  
  48.  
  49. while(0>CurrentNum){
  50. CurrentNum = 1 + CurrentNum;
  51. printf("%d",CurrentNum);
  52. printf(" ");
  53. }
  54. printf("!\n");
  55. printf("You can now count to zero from ");
  56. printf("%d",EndNum);
  57. }
  58.  
  59.  
  60. return 0;
  61. }
  62.  
Compilation error #stdin compilation error #stdout 0s 10320KB
stdin
5
compilation info
prog.c: In function ‘main’:
prog.c:31:14: error: ‘str’ undeclared (first use in this function)
 if (EndNum = str)
              ^~~
prog.c:31:14: note: each undeclared identifier is reported only once for each function it appears in
prog.c:31:4: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]
 if (EndNum = str)
    ^
stdout
Standard output is empty