fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. // your code goes here
  8. int num1=0;
  9. int num2=10;
  10. Console.WriteLine("Enter Number 1:");
  11. num1=int(Console.ReadLine());
  12. Console.WriteLine("Enter Number 2:");
  13. num2=int(Console.ReadLine());
  14.  
  15. string oddnum="";
  16. string evennum="";
  17. int flagodd=0;
  18. int flageven=0;
  19.  
  20. if (num2!=0)
  21. {
  22. for(int i=num1;i<=num2;i++)
  23. {
  24. if (i%2==0)
  25. {
  26. if (flageven==1)
  27. {
  28. evennum=evennum +" ," +i.ToString();
  29. }
  30. else
  31. {
  32. evennum=evennum +i.ToString();
  33. }
  34. flageven=1;
  35. }
  36. else
  37. {
  38. if (flagodd==1)
  39. {
  40. oddnum=oddnum +" ," +i.ToString();
  41. }
  42. else
  43. {
  44. oddnum=oddnum +i.ToString();
  45. }
  46.  
  47. flagodd=1;
  48. }
  49. }
  50. Console.WriteLine("The odd numbers between " +num1+ " and " +num2+ " is " +oddnum);
  51. Console.WriteLine("The even numbers between " +num1+ " and " +num2+ " is " +evennum);
  52. }
  53. }
  54. else
  55. {
  56. Console.WriteLine("Range not defined!")
  57. }
  58.  
  59.  
  60. }
Compilation error #stdin compilation error #stdout 0.02s 15972KB
stdin
Standard input is empty
compilation info
prog.cs(11,10): error CS1525: Unexpected symbol `(', expecting `.'
prog.cs(13,10): error CS1525: Unexpected symbol `(', expecting `.'
prog.cs(54,6): error CS1519: Unexpected symbol `else' in class, struct, or interface member declaration
prog.cs(55,3): error CS9010: Primary constructor body is not allowed
prog.cs(57,3): error CS1002: ; expected
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty