Computer Science, asked by arnavarma, 4 months ago

Q9. Write a program to display all the
odd numbers from 11-29.​

Answers

Answered by ms6211173
0

Answer:

Odd numbers always end with a digit of 1, 3, 5, 7, or 9.

1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 are odd numbers.

Explanation:

mark as brainlist

Answered by anindyaadhikari13
1

Answer:

These are the required program for the question.

1. In Java.

public class OddNum {

   public static void main(String args[])  {

       for(int i=11;i<=29;i+=2)

           System.out.print(i+" ");

   }

}

2. In Python.

print(" ".join(str(i) for i in range(11,30,2)))

3. In C

#include <stdio.h>

int main()  {

   for(int i=11;i<=29;i+=2)

       printf("%d ",i);

   return 0;

}

4. In C++

#include <iostream>

using namespace std;

int main()  {

   for(int i=11;i<=29;i++)

       cout << i << " ";

   return 0;

}

Algorithm:

  1. Iterate a loop in range 11 to 29.
  2. Display the value of the loop variable.
  3. Increment the value of looping variable by 2.

→ Logic is same in all languages but syntaxes differ.

•••♪

Similar questions