fork download
  1. using System;
  2. using iostream;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. int num,
  9. userGuess,
  10. result;
  11.  
  12. cout << "Enter a number." << endl;
  13. cin >> num;
  14. cout << endl
  15. << "How many prime numbers are between "
  16. << num
  17. << " and 0?" << endl;
  18. cin >> userGuess;
  19.  
  20. for (int i = num; i > 0; i--) {
  21. result = 0;
  22. if (i == 2) {
  23. result++;
  24. cout << i << " - prime." << endl;
  25. }
  26. else if (i == 1) {
  27. //cout << i << " - not prime." << endl;
  28. }
  29. else if (i % 2 == 0){
  30. //cout << i << " - not prime." << endl;
  31. }
  32. else if (i % 3 == 0){
  33. //cout << i << " - not prime." << endl;
  34. }
  35. else if (i % 5 == 0){
  36. //cout << i << " - not prime." << endl;
  37. }
  38. else if (i % 7 == 0){
  39. //cout << i << " - not prime." << endl;
  40. }
  41. else if (i % 9 == 0){
  42. //cout << i << " - not prime." << endl;
  43. }
  44. else {
  45. cout << i << " - prime." << endl;
  46. result++;
  47. }
  48. }
  49.  
  50. cout << result;
  51.  
  52.  
  53. return 0;
  54. }
  55. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
100
compilation info
prog.cs(2,7): error CS0246: The type or namespace name `iostream' could not be found. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty