A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C# program to print the odd numbers from 1 to 99. Prints one number per line
Q:

Write a C# program to print the odd numbers from 1 to 99. Prints one number per line

0

Write a C# program to print the odd numbers from 1 to 99. Prints one number per line

Sample Output:

Odd numbers from 1 to 99. Prints one number per line.                  
1                                                                      
3                                                                      
5                                                                      
7                                                                      
9                                                                      
11                                                                     
13                                                                     
15                                                                     
17                                                                     
19                                                                     
21                                                                     
23                                                                     
25                                                                     
27                                                                     
29                                                                     
31                                                                     
33 
35                                                                     
37                                                                     
39                                                                     
41                                                                     
43                                                                     
45                                                                     
47                                                                     
49                                                                     
51                                                                     
53                                                                     
55                                                                     
57                                                                     
59                                                                     
61                                                                     
63                                                                     
65                                                                     
67                                                                     
69                                                                     
71                                                                     
73 
73                                                                     
75                                                                     
77                                                                     
79                                                                     
81                                                                     
83                                                                     
85                                                                     
87                                                                     
89                                                                     
91                                                                     
93                                                                     
95                                                                     
97                                                                     
99

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;  
public class Exercise25
{  
    public static void Main() 
      {     
          Console.WriteLine("Odd numbers from 1 to 99. Prints one number per line.");
          for (int n = 1; n < (99 + 1); n++)
            {
                if (n % 2 != 0)
                {
                    Console.WriteLine(n.ToString());
                }
            }
                    
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now