fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <stdio.h>
  4. int main ()
  5. {
  6. /* variable definition: */
  7. int count, value, sum;
  8. /* Initialize */
  9. count = 0;
  10. value = 0;
  11. sum = 0.0;
  12. // Loop through to input values
  13. while (count =< 5)
  14. {
  15. printf("Enter a positive Integer\n");
  16. scanf("%d", &value);
  17. if (value >= 0)
  18. {
  19. sum = count * value;
  20. }
  21. else {
  22. printf("Value must be positive\n");
  23. }
  24. count++;
  25. // Calculate sum. Need to type cast since two integers will yield an integer sum = (double) sum*count;
  26. printf("sum is %lf\n " , value );
  27. return 0;
  28. }
  29.  
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:15: error: expected primary-expression before ‘<’ token
 while (count =< 5)
               ^
prog.cpp:28:1: error: expected ‘}’ at end of input
 }
 ^
stdout
Standard output is empty