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